Total Complexity | 2 |
Total Lines | 37 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | #!/usr/bin/env python3 |
||
2 | # -*- coding: utf-8 -*- |
||
3 | """ |
||
4 | Created on Fri Jul 5 15:57:10 2019 |
||
5 | |||
6 | @author: Paolo Cozzi <[email protected]> |
||
7 | """ |
||
8 | |||
9 | from common.tests import DataSourceMixinTestCase as CommonDataSourceMixinTest |
||
10 | |||
11 | from ..models import db_has_data, Animal, Sample, Submission |
||
12 | |||
13 | |||
14 | class DataSourceMixinTestCase(CommonDataSourceMixinTest): |
||
15 | # defining attribute classes |
||
16 | submission_model = Submission |
||
17 | |||
18 | def upload_datasource(self, message): |
||
19 | """test upload data from DatsSource""" |
||
20 | |||
21 | super(DataSourceMixinTestCase, self).upload_datasource(message) |
||
22 | |||
23 | # assert data into database |
||
24 | self.assertTrue(db_has_data()) |
||
25 | self.assertTrue(Animal.objects.exists()) |
||
26 | self.assertTrue(Sample.objects.exists()) |
||
27 | |||
28 | def check_errors(self, my_check, message): |
||
29 | """Common stuff for cehcking error in file loading""" |
||
30 | |||
31 | super(DataSourceMixinTestCase, self).check_errors(my_check, message) |
||
32 | |||
33 | # assert data into database |
||
34 | self.assertFalse(db_has_data()) |
||
35 | self.assertFalse(Animal.objects.exists()) |
||
36 | self.assertFalse(Sample.objects.exists()) |
||
37 |