More basic tests

This commit is contained in:
Mathieu Pillard 2010-01-28 17:39:41 +01:00 committed by Eric Florenzano
parent 837bdadd31
commit 0b9a075070
3 changed files with 18 additions and 2 deletions

BIN
avatar/testdata/imagefilewithoutext vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 KiB

View file

@ -42,7 +42,24 @@ class AvatarUploadTests(TestCase):
f.close()
self.failUnlessEqual(response.status_code, 200)
self.failUnlessEqual(response.context['upload_avatar_form'].errors, {})
#print response.context['upload_avatar_form'].errors
def testImageWithoutExtension(self):
f = open(os.path.join(self.testdatapath,"imagefilewithoutext"), "rb")
response = self.client.post(reverse('avatar_add'), {
'avatar': f,
})
f.close()
self.failUnlessEqual(response.status_code, 200)
self.failUnlessEqual(response.context['upload_avatar_form'].errors, {})
def testImageWithWrongExtension(self):
f = open(os.path.join(self.testdatapath,"imagefilewithwrongext.ogg"), "rb")
response = self.client.post(reverse('avatar_add'), {
'avatar': f,
})
f.close()
self.failUnlessEqual(response.status_code, 200)
self.failUnlessEqual(response.context['upload_avatar_form'].errors, {})
def testImageTooBig(self):
f = open(os.path.join(self.testdatapath,"testbig.png"), "rb")
@ -53,7 +70,6 @@ class AvatarUploadTests(TestCase):
self.failUnlessEqual(response.status_code, 200)
self.failIfEqual(response.context['upload_avatar_form'].errors, {})
# def testImageWithoutExtension
# def testTooManyAvatars
# def testReplaceAvatarWhenMaxIsOne
# def testHashFileName