def test_extra_fields(self): user = User(id=1, name='user1') user.extra = 'extra data' self.assertEqual('extra data', user.extra) d = user.fields() self.assertEquals(2, len(d)) self.assertEquals(1, d['id']) self.assertEquals('user1', d['name']) self.assertNotIn('extra', d)
def test_extra_fields(self): user = User(id=1, name='user1') user.update({'name': 'user2', 'extra': 'extra field'}) self.assertFalse(hasattr(user, 'extra'))
def test_normal(self): user = User(id=1, name='user1') user.update({'id': 1, 'name': 'user2'}) self.assertEquals(1, user.id) self.assertEquals('user2', user.name)
def test(self): user = User(id=1, name='user1') result = user.__json__() self.assertEqual(2, len(result)) self.assertEquals(1, result['id']) self.assertEquals('user1', result['name'])
def test_instance(self): user = User(id=1, name='user1') result = repr(user) self.assertEquals('<User 1>', result)
def test_single(self): user = User(id=1, name='user1') keys = user.keys() self.assertEquals((1, ), keys)
def test_normal(self): user = User(id=1, name='user1') d = user.fields() self.assertEquals(2, len(d)) self.assertEquals(1, d['id']) self.assertEquals('user1', d['name'])