"""Tests for PCAP generation and Content-Disposition filename.""" import struct import unittest from simtrace2_pysniff.pcap import build_pcap, PCAP_MAGIC, LINKTYPE_GSMTAP from simtrace2_pysniff.server.server import _content_disposition class TestBuildPcap(unittest.TestCase): def _gsmtap_hdr(self, sub_type): import struct return struct.pack('!BBBBHBBIBBBB', 2, 4, 7, 0, 0, 0, 0, 0, sub_type, 0, 0, 0) def test_empty(self): data = build_pcap([]) self.assertEqual(len(data), 24) # just the global header magic, vmaj, vmin, _tz, _sig, snaplen, network = struct.unpack('