Admin   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
c 0
b 0
f 0
dl 0
loc 22
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A test_merge_users_action() 0 5 1
A test_can_use_admin_backend() 0 3 1
A test_merge_users_view() 0 5 1
A test_test_machine_list_view() 0 5 1
1
'''
2
Test cases for 'GET' views and actions available for admins.
3
They include all cases for teachers through inheritance.
4
'''
5
6
from .cases import SubmitAdminTestCase
7
from .helpers.user import create_user, get_student_dict
8
from .helpers.testmachine import create_test_machine
9
10
11
class Admin(SubmitAdminTestCase):
12
    def test_merge_users_view(self):
13
        user1 = create_user(get_student_dict(1))
14
        user2 = create_user(get_student_dict(2))
15
        response = self.c.get('/mergeusers/{0}/{1}/'.format(user1.pk, user2.pk))
16
        self.assertEqual(response.status_code, 200)
17
18
    def test_merge_users_action(self):
19
        user1 = create_user(get_student_dict(1))
20
        user2 = create_user(get_student_dict(2))
21
        response = self.c.post('/mergeusers/{0}/{1}/'.format(user1.pk, user2.pk))
22
        self.assertEqual(response.status_code, 302)
23
24
    def test_test_machine_list_view(self):
25
        # one machine given
26
        create_test_machine('127.0.0.1')
27
        response = self.c.get('/teacher/opensubmit/testmachine/')
28
        self.assertEqual(response.status_code, 200)
29
30
    def test_can_use_admin_backend(self):
31
        response = self.c.get('/teacher/auth/user/')
32
        self.assertEqual(response.status_code, 200)
33