def test_basic(self): obj = SignedObject(name='foo', description='bar') assert_that(obj, is_not(None)) assert_that(obj, not_(has_property('name'))) assert_that(obj, not_(has_property('description'))) assert_that(obj.attributes, is_(set)) assert_that(obj.attributes, equal_to(set())) assert_that(obj.to_dict(), equal_to({}))
def test_basic_force(self): obj = SignedObject(name='foo', description='bar', _force=True) assert_that(obj, is_not(None)) assert_that(obj, has_properties(dict(name='foo', description='bar'))) assert_that(obj.attributes, is_(set)) assert_that(obj.attributes, has_items('name', 'description')) assert_that(obj.to_dict(), equal_to({ 'name': 'foo', 'description': 'bar' }))
def test_setattr(self): obj = SignedObject(name='foo', description='bar') assert_that(obj.attributes, is_(set())) assert_that(obj.attributes, equal_to(set([]))) assert_that(calling(obj.__setattr__).with_args('name', 'foo'), raises(SignatureException)) obj = SignedObject(name='foo', description='bar', _force=True) obj.name='foo2' assert_that(obj.name, equal_to('foo2')) assert_that(obj.to_dict(), equal_to({ 'name': 'foo2', 'description': 'bar' }))