def test_setattr_no_validate(self): a = PortalMember(validate=False) a.nonexistent_atrribute = 9 rand_name = _random_string() a.name = rand_name self.assertEqual(a.nonexistent_atrribute, 9) self.assertEqual(dict(a)['name'], rand_name)
def test_setattr_validate(self): a = PortalMember() a.nonexistent_atrribute = 9 rand_name = _random_string() a.name = rand_name self.assertEqual(a.nonexistent_atrribute, 9) self.assertEqual(dict(a)['name'], rand_name) with self.assertRaises(ValueError): a.password = ''