Completed
Push — master ( 897349...4f09bf )
by Alexander
109:51 queued 107:08
created

tcms.core.tests.test_history   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 14
dl 0
loc 24
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A RemoveUserWhenThereIsHistory.setUp() 0 7 2
A RemoveUserWhenThereIsHistory.test_remove_user() 0 8 2
1
# -*- coding: utf-8 -*-
2
# pylint: disable=invalid-name, no-member
3
4
from tcms.tests import BasePlanCase
5
6
7
class RemoveUserWhenThereIsHistory(BasePlanCase):
8
    def setUp(self):
9
        self.case.summary = 'editted to generate history'
10
        self.case.save()
11
        # map history to a user which we try to delete later
12
        for history_record in self.case.history.all():
13
            history_record.history_user = self.tester
14
            history_record.save()
15
16
    def test_remove_user(self):
17
        self.tester.delete()
18
        # 2 edits + 1 cascade delete
19
        self.assertEqual(3, self.case.history.count())
20
21
        # when users are removed this is supposed to be set to None
22
        for history_record in self.case.history.all():
23
            self.assertIsNone(history_record.history_user)
24