Completed
Pull Request — master (#51)
by Paolo
06:48
created

zooma.tests.test_views   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 24
dl 0
loc 48
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A OntologiesReportViewTest.setUp() 0 14 1
A OntologiesReportViewTest.test_url_resolves_view() 0 3 1
1
#!/usr/bin/env python3
2
# -*- coding: utf-8 -*-
3
"""
4
Created on Fri Sep 27 15:59:57 2019
5
6
@author: Paolo Cozzi <[email protected]>
7
"""
8
9
from django.test import TestCase, Client
10
from django.urls import resolve, reverse
11
12
from common.tests import GeneralMixinTestCase
13
14
from ..views import OntologiesReportView
15
16
17
class OntologiesReportViewTest(GeneralMixinTestCase, TestCase):
18
19
    fixtures = [
20
        "image_app/user",
21
        'image_app/dictbreed',
22
        'image_app/dictcountry',
23
        'image_app/dictrole',
24
        'image_app/dictsex',
25
        'image_app/dictspecie',
26
        'image_app/dictstage',
27
        'image_app/dictuberon',
28
    ]
29
30
    def setUp(self):
31
        """Set up"""
32
33
        super().setUp()
34
35
        # authenticate
36
        self.client = Client()
37
        self.client.login(username='test', password='test')
38
39
        # get the url for dashboard
40
        self.url = reverse('zooma:ontologies_report')
41
42
        # get a response
43
        self.response = self.client.get(self.url)
44
45
    def test_url_resolves_view(self):
46
        view = resolve('/zooma/ontologies_report/')
47
        self.assertIsInstance(view.func.view_class(), OntologiesReportView)
48