Example #1
0
 def setUp(self):
     self.role_dict = {"id": "1", "name": "KeystoneServiceAdmin"}
     self.role_serialized_str = json.dumps({"role": self.role_dict})
     self.expected_role = Role(id_="1", name="KeystoneServiceAdmin")
     self.role_dict_list = [self.role_dict]
     self.roles_serialized_str = json.dumps({"roles": self.role_dict_list})
     self.expected_roles = Roles(roles=[self.expected_role])
     self.expected_json = json.dumps({"role": self.role_dict})
Example #2
0
 def test_json_obj(self):
     assert self.expected_role == \
         Role._json_to_obj(self.role_serialized_str)
     assert self.expected_roles == \
         Roles._json_to_obj(self.roles_serialized_str)
Example #3
0
 def test_list_to_obj(self):
     assert self.expected_roles == Roles._list_to_obj(self.role_dict_list)