def test_equal(self): foo0 = FooEntity(id=0) mb0 = FooMember.create_from_entity(foo0) foo1 = FooEntity(id=1) mb1 = FooMember.create_from_entity(foo1) self.assert_true(mb0 == mb0) self.assert_true(mb0 != mb1)
def test_put_member_warning_exception(self, wrn_vw_app_creator): root = get_service() # Need to start the service manually - no request root has been set # yet. root.start() coll = root['foos'] mb = FooMember(FooEntity(id=0)) coll.add(mb) transaction.commit() path = '/'.join((self.path, '0')) # First PUT - get back a 307. res1 = wrn_vw_app_creator.put(path, params='foo name', status=307) assert res1.body.startswith(b'307 Temporary Redirect') # Second PUT to redirection location - get back a 200. resubmit_location1 = res1.headers['Location'] res2 = wrn_vw_app_creator.put(resubmit_location1, params='foo name', status=200) assert not res2 is None
def test__getitem__with_invalid_key_raises_error(self): foo = FooEntity(id=0) mb = FooMember.create_from_entity(foo) self.assert_raises(KeyError, mb.__getitem__, 'x')
def _extract_request_data(self): foo = FooEntity(name=self.request.body) return FooMember(foo)
def test_basics(self): foo = FooEntity() foo_mb = FooMember.create_from_entity(foo) self.coll.add(foo_mb) self.assert_true(self.session.iterator(FooEntity).next() is foo) self.assert_equal(len(list(self.session.iterator(FooEntity))), 1)