예제 #1
0
 def test_create_csv_tab_delimited(self):
     cleaned_data = self.cleaned_data
     cleaned_data['field_delimitor'] = 'TAB'
     table = VoucherTable(cleaned_data)
     expected = 'Wahlberg\t646\t-'
     response = table.create_csv_file()
     result = response.content.decode('utf-8')
     self.assertTrue(expected in result)
예제 #2
0
 def test_create_csv_other_delimitation(self):
     cleaned_data = self.cleaned_data
     cleaned_data['field_delimitor'] = 'other symbol'
     table = VoucherTable(cleaned_data)
     expected = 'Wahlberg,646,-'
     response = table.create_csv_file()
     result = response.content.decode('utf-8')
     self.assertTrue(expected in result)
예제 #3
0
 def test_create_csv_exist_or_empty(self):
     cleaned_data = self.cleaned_data
     cleaned_data['gene_info'] = 'EXIST OR EMPTY'
     table = VoucherTable(cleaned_data)
     expected = ',X,-,-'
     response = table.create_csv_file()
     result = response.content.decode('utf-8')
     self.assertTrue(expected in result)
예제 #4
0
 def test_create_csv_accession_number(self):
     cleaned_data = self.cleaned_data
     cleaned_data['gene_info'] = 'ACCESSION NUMBER'
     table = VoucherTable(cleaned_data)
     expected = 'AY218269,AY218260'
     response = table.create_csv_file()
     result = response.content.decode('utf-8')
     self.assertTrue(expected in result)
예제 #5
0
 def test_create_csv_number_bases_by_default(self):
     cleaned_data = self.cleaned_data
     cleaned_data['gene_info'] = ''
     table = VoucherTable(cleaned_data)
     expected = ',669,1227,412'
     response = table.create_csv_file()
     result = response.content.decode('utf-8')
     self.assertTrue(expected in result)
예제 #6
0
 def test_create_csv_missing_voucher(self):
     cleaned_data = self.cleaned_data
     cleaned_data['voucher_codes'] = 'CP1000-1000'
     table = VoucherTable(cleaned_data)
     table.create_csv_file()
     expected = 'We don\'t have voucher CP1000-1000 in our database.'
     result = table.warnings
     self.assertTrue(expected in result)
예제 #7
0
    def setUp(self):
        args = []
        opts = {'dumpfile': 'test_db_dump.xml', 'verbosity': 0}
        cmd = 'migrate_db'
        call_command(cmd, *args, **opts)

        taxonset = TaxonSets.objects.all()[0]
        geneset = GeneSets.objects.all()[0]

        self.cleaned_data = {
            'collector_info': ['country', 'specific_locality', 'collector'],
            'gene_codes': [],
            'gene_info': 'NUMBER OF BASES',
            'voucher_info': ['code', 'genus', 'species'],
            'field_delimitor': 'COMMA',
            'taxonset': taxonset,
            'voucher_codes': '',
            'geneset': geneset,
        }
        self.table = VoucherTable(self.cleaned_data)
        self.maxDiff = None