def test_add_same_image_with_data(self): EMAIL = '*****@*****.**' NAME = 'akiva' setCurrentUser(EMAIL, NAME) add_image(data=TEST_BINARY_DATA) EMAIL2 = '*****@*****.**' NAME2 = 'test' setCurrentUser(EMAIL2, NAME2) image2 = add_image(data=TEST_BINARY_DATA) self.assertEquals(image2.artist, NAME)
def test_add_image_with_link(self): EMAIL = '*****@*****.**' NAME = 'akiva' setCurrentUser(EMAIL, NAME) image = add_image(link=TEST_IMAGE_LINK) self.assertEquals(image.user.name, NAME) self.assertEquals(image.artist, NAME) self.assertEquals(image.data.link, TEST_IMAGE_LINK) img = images.Image(image.data.data) self.assertEquals(img.width, 32) self.assertEquals(img.height, 32)
def test_add_image_with_data(self): EMAIL = '*****@*****.**' NAME = 'akiva' setCurrentUser(EMAIL, NAME) image = add_image(data=TEST_BINARY_DATA) self.assertEquals(image.user.name, NAME) self.assertEquals(image.artist, NAME) self.assertEquals(image.data.link, 'binary data') img = images.Image(image.data.data) self.assertEqual(img.width, 27) self.assertEqual(img.height, 23) self.assertEqual(img.format, images.PNG)
def test_add_image_logged_out(self): logoutCurrentUser() image = add_image(link=TEST_IMAGE_LINK) self.assertEquals(image, None)