Пример #1
0
 def test_origin_exists(self):
     self.app.update(app_domain='app://hy.fr')
     form = forms.NewPackagedAppForm({}, self.files)
     assert not form.is_valid()
     validation = json.loads(form.file_upload.validation)
     eq_(validation['messages'][0]['message'],
         'An app already exists on this domain; only one app per domain is '
         'allowed.')
Пример #2
0
 def test_too_big(self):
     form = forms.NewPackagedAppForm({}, self.files, max_size=5)
     assert not form.is_valid()
     validation = json.loads(form.file_upload.validation)
     assert 'messages' in validation, 'No messages in validation.'
     eq_(validation['messages'][0]['message'],
         u'Packaged app too large for submission. Packages must be smaller '
         u'than 5 bytes.')
Пример #3
0
 def test_right_size(self):
     form = forms.NewPackagedAppForm({}, self.files)
     assert form.is_valid(), form.errors
     assert form.file_upload
Пример #4
0
 def test_not_there(self):
     form = forms.NewPackagedAppForm({}, {})
     assert not form.is_valid()
     eq_(form.errors['upload'], [u'This field is required.'])
     eq_(form.file_upload, None)