def test_resource_init_attrs(self): r = resources.Resource(_name=self.test_name, _info=self.test_info_0) r.b = "b" self.assertEqual("a", r.a) self.assertEqual("b", r.__getattr__("b")) self.assertIn("b", r.__dict__) self.assertEqual(self.test_info_0, r._info) self.assertEqual(self.test_name, r._name) self.assertEqual(self.test_name, r.__resource_name__)
def test_repr(self): r = resources.Resource(_name=self.test_name, _info=self.test_info_0) dict_repr = self.test_info_0.__repr__() self.assertEqual("<test_res %s>" % dict_repr, r.__repr__())
def test_as_resource(self): r = resources.Resource(_name=self.test_name, _info=self.test_info_0) self.assertEqual(r, r.as_resource())
def test_resource_eq(self): r0 = resources.Resource(_name=self.test_name, _info=self.test_info_0) r1 = resources.Resource(_name=self.test_name, _info=self.test_info_1) self.assertFalse(r0 == r1)
def test_resource_to_dict(self): r = resources.Resource(_name=self.test_name, _info=self.test_info_0) self.assertEqual(self.test_info_0, r.to_dict()) self.assertEqual({self.test_name: self.test_info_0}, r.wrapped_dict)
def test_resource_eq(self): r0 = resources.Resource(_name=self.test_name, _info=self.test_info_0) r1 = resources.Resource(_name=self.test_name, _info=self.test_info_1) self.assertNotEqual(r0, r1)