def test_form_same_app_version(self): data = {'name': 'name', 'version': 'version'} file_data = {'plist': SimpleUploadedFile('someapp.plist()', self.app.plist.read()), 'ipa': SimpleUploadedFile('someapp.ipa()', self.app.ipa.read())} form = AppForm(data, file_data) self.assertFalse(form.is_valid()) self.assertTrue('App with this App name and Version already exists' in form.errors.__unicode__())
def test_form_validation_passes_valid_app(self): new_app = self.get_app('1.1') data = {'name': 'name', 'version': 'version'} # Name and version still need to be present file_data = {'plist': SimpleUploadedFile('someapp.plist', new_app.plist.read()), 'ipa': SimpleUploadedFile('someapp.ipa', new_app.ipa.read())} form = AppForm(data, file_data) self.assertTrue(form.is_valid())
def test_form_validation_bad_plist_and_ipa(self): data = {'name': 'name', 'version': 'version'} file_data = { 'plist': SimpleUploadedFile('someapp.lkjs', self.app.plist.read()), 'ipa': SimpleUploadedFile('someapp.sdfklj', '') } form = AppForm(data, file_data) self.assertFalse(form.is_valid())
def test_form_same_app_version(self): data = {'name': 'name', 'version': 'version'} file_data = { 'plist': SimpleUploadedFile('someapp.plist()', self.app.plist.read()), 'ipa': SimpleUploadedFile('someapp.ipa()', self.app.ipa.read()) } form = AppForm(data, file_data) self.assertFalse(form.is_valid()) self.assertTrue('App with this App name and Version already exists' in form.errors.__unicode__())
def test_form_validation_passes_valid_app(self): new_app = self.get_app('1.1') data = { 'name': 'name', 'version': 'version' } # Name and version still need to be present file_data = { 'plist': SimpleUploadedFile('someapp.plist', new_app.plist.read()), 'ipa': SimpleUploadedFile('someapp.ipa', new_app.ipa.read()) } form = AppForm(data, file_data) self.assertTrue(form.is_valid())
def test_form_validation_bad_plist_and_ipa(self): data = {'name': 'name', 'version': 'version'} file_data = {'plist': SimpleUploadedFile('someapp.lkjs', self.app.plist.read()), 'ipa': SimpleUploadedFile('someapp.sdfklj', '')} form = AppForm(data, file_data) self.assertFalse(form.is_valid())