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

RemoveUserWhenThereIsHistory.setUp()   A

Complexity

Conditions 2

Size

Total Lines 7
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 2
nop 1
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