Ejemplo n.º 1
0
 def test_dict_to_obj(self):
     """
     test to verify Catalog.json_to_obj() can convert a JSON
     representation of a Catalog to a Catalog object
     """
     # ARRANGE
     catalog_dict = {
         'catalog': 'test_catalog',
         'links': 'test_links'
     }
     expected_catalog_obj = ['mocked stuff', 'mocked stuff']
     # ACT
     catalog_resp_obj = Catalog._dict_to_obj(catalog_dict)
     # ASSERT
     self.assertEqual(expected_catalog_obj, catalog_resp_obj)
Ejemplo n.º 2
0
 def _dict_to_obj(cls, data):
     """
     @summary: Converting Dictionary Representation of AuthResponse object
         to AuthResponse object
     @return: AuthResponse object
     @param data: Dictionary Representation of AuthResponse object
     """
     if data is None:
         return None
     return cls(
         token=AuthResponseToken._dict_to_obj(data.get("token")),
         roles=Roles._dict_to_obj(data.get("roles") or []),
         user=User._dict_to_obj(data.get("user")),
         catalog=Catalog._dict_to_obj(data.get("catalog")) or [],
         issued_at=data.get("issued_at"),
         extras=data.get("extras"),
         methods=data.get("methods"),
         project=Project._dict_to_obj(data.get("project")),
         expires_at=data.get("expires_at"))