def test_mapping_request_serialization(self): e = MappingRequest(method="GET", url="test1", url_path="test2", url_path_pattern="test3", url_pattern="test4", basic_auth_credentials=BasicAuthCredentials( username="******", password="******"), cookies={"chocolate": "chip"}, headers={"Accept": "stuff"}, query_parameters={"param": "1"}, body_patterns={"test": "test2"}, metadata={'key': 'value'}) serialized = e.get_json_data() self.assertDictContainsKeyWithValue(serialized, "method", "GET") self.assertDictContainsKeyWithValue(serialized, "url", "test1") self.assertDictContainsKeyWithValue(serialized, "urlPath", "test2") self.assertDictContainsKeyWithValue(serialized, "urlPathPattern", "test3") self.assertDictContainsKeyWithValue(serialized, "urlPattern", "test4") self.assertDictContainsKeyWithValue(serialized, "basicAuthCredentials", { "username": "******", "password": "******" }) self.assertDictContainsKeyWithValue(serialized, "cookies", {"chocolate": "chip"}) self.assertDictContainsKeyWithValue(serialized, "headers", {"Accept": "stuff"}) self.assertDictContainsKeyWithValue(serialized, "queryParameters", {"param": "1"}) self.assertDictContainsKeyWithValue(serialized, "bodyPatterns", {"test": "test2"}) self.assertDictContainsKeyWithValue(serialized, "metadata", {"key": "value"})
def test_mapping_request_serialization(self): e = MappingRequest(method='GET', url='test1', url_path='test2', url_path_pattern='test3', url_pattern='test4', basic_auth_credentials=BasicAuthCredentials( username='******', password='******'), cookies={'chocolate': 'chip'}, headers={'Accept': 'stuff'}, query_parameters={'param': '1'}, body_patterns={'test': 'test2'}) serialized = e.get_json_data() self.assertDictContainsKeyWithValue(serialized, 'method', 'GET') self.assertDictContainsKeyWithValue(serialized, 'url', 'test1') self.assertDictContainsKeyWithValue(serialized, 'urlPath', 'test2') self.assertDictContainsKeyWithValue(serialized, 'urlPathPattern', 'test3') self.assertDictContainsKeyWithValue(serialized, 'urlPattern', 'test4') self.assertDictContainsKeyWithValue(serialized, 'basicAuthCredentials', { 'username': '******', 'password': '******' }) self.assertDictContainsKeyWithValue(serialized, 'cookies', {'chocolate': 'chip'}) self.assertDictContainsKeyWithValue(serialized, 'headers', {'Accept': 'stuff'}) self.assertDictContainsKeyWithValue(serialized, 'queryParameters', {'param': '1'}) self.assertDictContainsKeyWithValue(serialized, 'bodyPatterns', {'test': 'test2'})