Total Complexity | 2 |
Total Lines | 54 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | #!/usr/bin/env python3 |
||
2 | # -*- coding: utf-8 -*- |
||
3 | """ |
||
4 | Created on Thu Jun 20 16:56:43 2019 |
||
5 | |||
6 | @author: Paolo Cozzi <[email protected]> |
||
7 | """ |
||
8 | |||
9 | from django.test import TestCase |
||
10 | |||
11 | from ..models import ValidationSummary |
||
12 | |||
13 | |||
14 | class ValidationSummaryTestCase(TestCase): |
||
15 | """Testing ValidationSummary class""" |
||
16 | |||
17 | fixtures = [ |
||
18 | 'image_app/animal', |
||
19 | 'image_app/dictbreed', |
||
20 | 'image_app/dictcountry', |
||
21 | 'image_app/dictrole', |
||
22 | 'image_app/dictsex', |
||
23 | 'image_app/dictspecie', |
||
24 | 'image_app/dictstage', |
||
25 | 'image_app/dictuberon', |
||
26 | 'image_app/name', |
||
27 | 'image_app/organization', |
||
28 | 'image_app/publication', |
||
29 | 'image_app/sample', |
||
30 | 'image_app/submission', |
||
31 | 'image_app/user', |
||
32 | 'validation/validationsummary', |
||
33 | ] |
||
34 | |||
35 | def setUp(self): |
||
36 | self.vs_animal = ValidationSummary.objects.get(pk=1) |
||
37 | self.vs_sample = ValidationSummary.objects.get(pk=2) |
||
38 | |||
39 | def test_reset_all_count(self): |
||
40 | # set a different count objects |
||
41 | self.vs_animal.all_count = 99 |
||
42 | self.vs_animal.save() |
||
43 | |||
44 | self.vs_sample.all_count = 99 |
||
45 | self.vs_sample.save() |
||
46 | |||
47 | # now call methods |
||
48 | self.vs_animal.reset_all_count() |
||
49 | self.vs_sample.reset_all_count() |
||
50 | |||
51 | # assert true values (calculated accordingly Animals and Samples) |
||
52 | self.assertEqual(self.vs_animal.all_count, 3) |
||
53 | self.assertEqual(self.vs_sample.all_count, 1) |
||
54 |