mirror of
https://github.com/jazzband/django-avatar.git
synced 2026-03-16 22:20:30 +00:00
More basic tests
This commit is contained in:
parent
837bdadd31
commit
0b9a075070
3 changed files with 18 additions and 2 deletions
BIN
avatar/testdata/imagefilewithoutext
vendored
Normal file
BIN
avatar/testdata/imagefilewithoutext
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 136 KiB |
BIN
avatar/testdata/imagefilewithwrongext.ogg
vendored
Normal file
BIN
avatar/testdata/imagefilewithwrongext.ogg
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 136 KiB |
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue