def testGetUserFromId(self): """Tests RpxBackend.get_user(). Make sure it handles None and negative results. """ try: RpxBackend.get_user(self.backend, None) self.assert_(False) except: pass self.assert_(RpxBackend.get_user(self.backend, "willnotfind") == None) user = User(username="******") user.save() rpx_data = RpxData(user=user) rpx_data.save() #Test that is can handle key from non User class and returns None self.assert_(RpxBackend.get_user(self.backend, rpx_data.key()) == None) RpxBackend.delete_user(self.backend, user)
def testDeleteUser(self): """Tests RpxBackend.delete_user(). Tests that both the user and the associated RPX data entries are deleted. """ user, auth_info = self.__create_normal_user__() user_key = user.key() number_of_users_entries = User.all().count() number_of_rpx_entries = RpxData.all().count() RpxBackend.delete_user(self.backend, user) self.assert_(User.all().count() == number_of_users_entries - 1) self.assert_(RpxData.all().count() == number_of_rpx_entries - 1) self.assert_(RpxBackend.get_user(self.backend, user_key) == None)