Example #1
0
 def test_to_dict(self):
     dict = {"name": "test"}
     resource = test_base.TestResource(None, dict)
     self.assertEqual(
         {
             'description': 'Test Description',
             'extra': 'extra',
             'name': 'test'
         }, resource.to_dict())
 def test_resource_str(self):
     dict = {"name": "test", "description": "Changed Description"}
     resource = test_base.TestResource(None, dict)
     rstr = str(resource)
     self.assertIn(resource.resource_name, rstr)
     self.assertIn("name", rstr)
     self.assertIn("description", rstr)
     self.assertIn("Changed Description", rstr)
     self.assertNotIn("Test Description", rstr)
     self.assertIn("extra", rstr)
     self.assertNotIn("manager", rstr)
 def test_create_dont_modify_info_dict(self):
     dict = {"name": "test", "description": "Changed Description"}
     dict_copy = dict.copy()
     resource = test_base.TestResource(None, dict)
     self.assertIsNotNone(resource)
     self.assertEqual(dict_copy, dict)
 def test_overwrite_default(self):
     dict = {"name": "test", "description": "Changed Description"}
     resource = test_base.TestResource(None, dict)
     self.assertEqual("test", resource.name)
     self.assertEqual("Changed Description", resource.description)
     self.assertEqual("extra", resource.extra)
 def test_create_resource(self):
     dict = {"name": "test"}
     resource = test_base.TestResource(None, dict)
     self.assertEqual("test", resource.name)
     self.assertEqual("Test Description", resource.description)