def test_mapping_request_deserialization(self):
     serialized = {
         "method": "GET",
         "url": "test1",
         "urlPath": "test2",
         "urlPathPattern": "test3",
         "urlPattern": "test4",
         "basicAuthCredentials": {
             "username": "******",
             "password": "******"
         },
         "cookies": {
             "chocolate": "chip"
         },
         "headers": {
             "Accept": "stuff"
         },
         "queryParameters": {
             "param": "1"
         },
         "bodyPatterns": {
             "test": "test2"
         },
         'metadata': {
             'key': [1, 2, 3]
         },
     }
     e = MappingRequest.from_dict(serialized)
     self.assertIsInstance(e, MappingRequest)
     self.assertEqual("GET", e.method)
     self.assertEqual("test1", e.url)
     self.assertEqual("test2", e.url_path)
     self.assertEqual("test3", e.url_path_pattern)
     self.assertEqual("test4", e.url_pattern)
     self.assertIsInstance(e.basic_auth_credentials, BasicAuthCredentials)
     self.assertEqual("username", e.basic_auth_credentials.username)
     self.assertEqual("password", e.basic_auth_credentials.password)
     self.assertEqual({"chocolate": "chip"}, e.cookies)
     self.assertEqual({"Accept": "stuff"}, e.headers)
     self.assertEqual({"param": "1"}, e.query_parameters)
     self.assertEqual({"test": "test2"}, e.body_patterns)
     self.assertEqual({"key": [1, 2, 3]}, e.metadata)
Beispiel #2
0
 def test_mapping_request_deserialization(self):
     serialized = {
         'method': 'GET',
         'url': 'test1',
         'urlPath': 'test2',
         'urlPathPattern': 'test3',
         'urlPattern': 'test4',
         'basicAuthCredentials': {
             'username': '******',
             'password': '******'
         },
         'cookies': {
             'chocolate': 'chip'
         },
         'headers': {
             'Accept': 'stuff'
         },
         'queryParameters': {
             'param': '1'
         },
         'bodyPatterns': {
             'test': 'test2'
         }
     }
     e = MappingRequest.from_dict(serialized)
     self.assertIsInstance(e, MappingRequest)
     self.assertEquals('GET', e.method)
     self.assertEquals('test1', e.url)
     self.assertEquals('test2', e.url_path)
     self.assertEquals('test3', e.url_path_pattern)
     self.assertEquals('test4', e.url_pattern)
     self.assertIsInstance(e.basic_auth_credentials, BasicAuthCredentials)
     self.assertEquals('username', e.basic_auth_credentials.username)
     self.assertEquals('password', e.basic_auth_credentials.password)
     self.assertEquals({'chocolate': 'chip'}, e.cookies)
     self.assertEquals({'Accept': 'stuff'}, e.headers)
     self.assertEquals({'param': '1'}, e.query_parameters)
     self.assertEquals({'test': 'test2'}, e.body_patterns)