def test_generate(self):
        """Ensure we can call the /generate endpoint."""
        # NOTE these are L's and not ones
        input_data_string = "data would go here"
        expected_output = r"data\x20would\x20go\x20here"
        post_args = {
            "l3_src_ip": "$HOME_NET",
            "l3_dst_ip": "$HOME_NET",
            "l3_protocol": "TCP",
            "l3_flow_established": "yes",
            "l4_src_port": "any",
            "l4_dst_port": "any",
            "payload_format": "http",  # 'http', 'raw' or 'cert'
            "payload_http_request_contentlength": "on",
            "request_header": "",
            "request_body": input_data_string,
            "generate_method": "build",
        }
        url = "/flowsynth/generate"
        response = self.client.post(
            url,
            data=urlencode(post_args),
            content_type="application/x-www-form-urlencoded",
        )
        self.assertEqual(200, response.status_code)
        self.assertIn("flow default tcp 192", response.data.decode())
        self.assertIn(expected_output, response.data.decode())
Ensure we can call the /generate endpoint.
tests/test_flowsynth.py