Пример #1
0
 def test_form_style_uri_parameter(self):
     parameters = [
         {
             "name": "id", 
             "example": "15",
         }
     ]
     self.assertEqual(instantiate_uri('/Entity{?id}', parameters), '/Entity?id=15')
Пример #2
0
 def test_hashtag_uri_parameters(self):
     parameters = [
         {
             "name": "id", 
             "example": "15",
         }
     ]
     self.assertEqual(instantiate_uri('/Entity/{#id}', parameters), '/Entity/#15')
Пример #3
0
 def test_simple_empty_uri_parameter(self):
     parameters = [
         {
             "name": "id", 
             "example": "",
         }
     ]
     self.assertEqual(instantiate_uri('/Entity/{id}', parameters), '/Entity/{id}')
Пример #4
0
 def test_ampersand_uri_parameter(self):
     parameters = [
         {
             "name": "id", 
             "example": "15",
         }
     ]
     self.assertEqual(instantiate_uri('/Entity{&id}', parameters), '/Entity&id=15')
Пример #5
0
 def test_empty_plus_uri_parameters(self):
     parameters = [
         {
             "name": "resource_path", 
             "example": "",
         }
     ]
     self.assertEqual(instantiate_uri('/Entity/{+resource_path}', parameters), '/Entity/{+resource_path}')
Пример #6
0
 def test_multiple_form_style_uri_parameters(self):
     parameters = [
         {
             "name": "id", 
             "example": "15",
         },
         {
             "name": "name", 
             "example": "entity-name",
         }
     ]
     self.assertEqual(instantiate_uri('/Entity/{?id,name}', parameters), '/Entity/?id=15&name=entity-name')
Пример #7
0
 def test_multiple_simple_uri_parameters(self):
     parameters = [
         {
             "name": "id", 
             "example": "15",
         },
         {
             "name": "name", 
             "example": "entity-name",
         }
     ]
     self.assertEqual(instantiate_uri('/Entity/{id,name}', parameters), '/Entity/15entity-name')
Пример #8
0
 def test_multiple_ampersand_uri_paramaters_with_empty_one(self):
     parameters = [
         {
             "name": "id", 
             "example": "",
         },
         {
             "name": "name", 
             "example": "entity-name",
         }
     ]
     self.assertEqual(instantiate_uri('/Entity{&id,name}', parameters), '/Entity&name=entity-name')
Пример #9
0
 def test_multiple_plus_uri_parameters(self):
     parameters = [
         {
             "name": "resource_path_1", 
             "example": "path/to/resource/1",
         },
         {
             "name": "resource_path_2", 
             "example": "",
         }
     ]
     self.assertEqual(instantiate_uri('/Entity/{+resource_path_1,resource_path_2}', parameters), '/Entity/path/to/resource/1{+resource_path_2}')
Пример #10
0
 def test_multiple_form_style_uri_parameters_with_empty_ones(self):
     parameters = [
         {
             "name": "id", 
             "example": "15",
         },
         {
             "name": "name", 
             "example": "",
         }
     ]
     self.assertEqual(instantiate_uri('/Entity/{?id,name}', parameters), '/Entity/?id=15')
Пример #11
0
    def test_multiple_blocks_bug(self):
        parameters = [
            {
                "name": "environment", 
                "example": "env1",
            },
            {
                "name": "tier", 
                "example": "tier1",
            }
        ]

        self.assertEqual(instantiate_uri('/rest/catalog/org/FIWARE/environment/{environment}/tier/{tier}', parameters),'/rest/catalog/org/FIWARE/environment/env1/tier/tier1')
Пример #12
0
 def test_empty_form_style_uri_parameter(self):
     parameters = []
     self.assertEqual(instantiate_uri('/Entity{?id}', parameters), '/Entity')
Пример #13
0
 def test_empty_hashtag_uri_parameters(self):
     parameters = []
     self.assertEqual(instantiate_uri('/Entity/{#id}', parameters), '/Entity/{#id}')
Пример #14
0
 def test_empty_ampersand_uri_parameter(self):
     parameters = []
     self.assertEqual(instantiate_uri('/Entity{&id}', parameters), '/Entity')