def test_compare_form_bad_chars_fasta(self): form_data = { 'name': 'test-name', 'fasta': '12345', 'domain': 'Universal', 'clade': '4930', 'isotype': 'All', 'use_fasta': 'True' } form = forms.CompareForm(data=form_data) self.assertFalse(form.is_valid()) form_data[ 'fasta'] = '>myseq\nACTGACATCGTAGCTAGTACG\n%%%%^^^***AF<><>AJFJGOSFES\nACTATATA\n>seq2\nACACACACACACAC' form = forms.CompareForm(data=form_data) self.assertFalse(form.is_valid())
def test_compare_form_missing_clade(self): form_data = { 'name': 'test-name', 'clade': '', 'isotype': 'All', 'use_fasta': False } form = forms.CompareForm(data=form_data) self.assertFalse(form.is_valid())
def test_compare_form_no_domain(self): form_data = { 'name': 'test-name', 'fasta': '', 'clade': '4930', 'isotype': 'All', 'use_fasta': 'True' } form = forms.CompareForm(data=form_data) self.assertFalse(form.is_valid())
def test_compare_form_valid_fasta(self): form_data = { 'name': 'test-name', 'fasta': '>myseq\nACTG', 'clade': '4930', 'isotype': 'All', 'use_fasta': 'True' } form = forms.CompareForm(data=form_data) self.assertTrue(form.is_valid())
def test_compare_form_toggle_disable_fasta_validation(self): form_data = { 'name': 'test-name', 'fasta': 'invalid fasta', 'clade': '4930', 'isotype': 'All', 'use_fasta': False } form = forms.CompareForm(data=form_data) self.assertTrue(form.is_valid()) self.assertFalse(form.has_error('fasta'))
def test_compare_form_malformed_fasta(self): form_data = { 'name': 'test-name', 'fasta': 'AGACAGCGATGC', 'domain': 'Universal', 'clade': '4930', 'isotype': 'All', 'use_fasta': 'True' } form = forms.CompareForm(data=form_data) self.assertFalse(form.is_valid())
def test_compare_form_invalid_clade_select(self): form_data = { 'name': 'test-name', 'fasta': '', 'clade': 'asdf', 'isotype': 'All', 'use_fasta': 'False' } form = forms.CompareForm(data=form_data) self.assertFalse(form.is_valid()) self.assertEquals( form.errors['clade'][0], 'Select a valid choice. asdf is not one of the available choices.')