Code Duplication    Length = 22-24 lines in 2 locations

tests/unit/test_main.py 2 locations

@@ 114-137 (lines=24) @@
111
                         'Start in the past not allowed')
112
        self.scheduler.add.assert_not_called()
113
114
    def test_create_mw_case_4(self):
115
        """Test a fail case of the REST to create a maintenance window."""
116
        url = f'{self.server_name_url}'
117
        start = datetime.now(pytz.utc) + timedelta(days=1)
118
        end = start - timedelta(hours=2)
119
        payload = {
120
            "start": start.strftime(TIME_FMT),
121
            "end": end.strftime(TIME_FMT),
122
            "start": start.strftime(TIME_FMT),
123
            "end": end.strftime(TIME_FMT),
124
            "switches": [
125
                "00:00:00:00:00:00:02",
126
            ],
127
            'interfaces': [
128
                "00:00:00:00:00:00:00:03:3",
129
            ],
130
        }
131
        response = self.api.post(url, data=json.dumps(payload),
132
                                 content_type='application/json')
133
        current_data = json.loads(response.data)
134
        self.assertEqual(response.status_code, 400)
135
        self.assertEqual(current_data['description'],
136
                         'End before start not allowed')
137
        self.scheduler.add.assert_not_called()
138
139
    def test_get_mw_case_1(self):
140
        """Test get all maintenance windows, empty list."""
@@ 91-112 (lines=22) @@
88
        self.assertEqual(response.status_code, 400)
89
        self.scheduler.add.assert_not_called()
90
91
    def test_create_mw_case_3(self):
92
        """Test a fail case of the REST to create a maintenance window."""
93
        url = f'{self.server_name_url}'
94
        start = datetime.now(pytz.utc) - timedelta(days=1)
95
        end = start + timedelta(hours=2)
96
        payload = {
97
            "start": start.strftime(TIME_FMT),
98
            "end": end.strftime(TIME_FMT),
99
            "switches": [
100
                "00:00:00:00:00:00:02",
101
            ],
102
            'interfaces': [
103
                "00:00:00:00:00:00:00:03:3",
104
            ],
105
        }
106
        response = self.api.post(url, data=json.dumps(payload),
107
                                 content_type='application/json')
108
        current_data = json.loads(response.data)
109
        self.assertEqual(response.status_code, 400)
110
        self.assertEqual(current_data['description'],
111
                         'Start in the past not allowed')
112
        self.scheduler.add.assert_not_called()
113
114
    def test_create_mw_case_4(self):
115
        """Test a fail case of the REST to create a maintenance window."""