def test_delete_user(self): """Method to test deleting user map.""" user_map = UserMapFactory.create() self.assertIsNotNone(user_map.pk) user_map.delete() message = 'The user map is not deleted.' self.assertIsNone(user_map.pk, message)
def test_update_usermap(self): """Method to test updating usermap.""" user_map = UserMapFactory() new_location = Point(10, 10) user_map.location = new_location user_map.save() message = 'The user map location should be %s, but it gives %s' % ( new_location, user_map.location) self.assertEqual(new_location, user_map.location, message) new_image = '/new/image.png' user_map.image = new_image user_map.save() message = 'The user map image should be %s, but it gives %s' % ( new_image, user_map.image) self.assertEqual(new_image, user_map.image, message)
def setUp(self): """Run for each test.""" self.not_mapped_username = '******' self.not_mapped_password = '******' self.not_mapped_user = UserFactory.create( username=self.not_mapped_username, password=self.not_mapped_password) self.mapped_username = '******' self.mapped_password = '******' self.mapped_user = UserFactory.create(username=self.mapped_username, password=self.mapped_password) self.mapped_user_map = UserMapFactory(user=self.mapped_user) self.client = Client()
def test_read_usermap(self): """Method to test reading user map.""" user = UserFactory(username='******') location = Point(5, 5) image = '/john/doe/image.png' usermap = UserMapFactory.create(user=user, location=location, image=image) message = 'The username should be %s, but it gives %s' % ( user.username, usermap.user.username) self.assertEqual(user.username, usermap.user.username, message) message = 'The user location should be %s, but it gives %s' % ( location, usermap.location) self.assertEqual(location, usermap.location, message) message = 'The user image should be %s, but it gives %s' % ( image, usermap.image) self.assertEqual(image, usermap.image, message)
def test_create_usermap(self): """Method to test user map creation.""" user_map = UserMapFactory.create() message = 'The user map is not instantiated successfully.' self.assertIsNotNone(user_map.user, message)