Completed
Branch master (206998)
by Paolo
02:15 queued 15s
created

validation.tests.test_models   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 32
dl 0
loc 54
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A ValidationSummaryTestCase.setUp() 0 3 1
A ValidationSummaryTestCase.test_reset_all_count() 0 15 1
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