def test_retrieve_pcap(self, mock_pcap_path):
        """Confirm '/flowsynth/pcap/get_pcap' endpoint is working."""
        # Copy the KNOWN_PCAP file into PCAP_PATH/<pcap_id>.pcap.
        pcap_id = random.randint(100000, 999999)
        path = get_pcap_file_path(pcap_id, path=self.pcap_base)
        mock_pcap_path.side_effect = [path]
        with open(path, "wb") as fd:
            pcap_data = self.read_pcap_file(None, random=True)
            fd.write(pcap_data.read())
        url = f"/flowsynth/pcap/get_pcap/{pcap_id}"
        response = self.client.get(url)
        self.assertEqual(200, response.status_code)
        self.assertEqual("application/vnd.tcpdump.pcap", response.content_type)
        self.assertEqual(
            f"attachment;filename={pcap_id}.pcap",
            response.headers["Content-Disposition"],
        )
        self.assertIn(KNOWN_PCAP_CONTENTS, response.data)
Confirm '/flowsynth/pcap/get_pcap' endpoint is working.
tests/test_flowsynth.py