Code Duplication    Length = 22-24 lines in 2 locations

tests/unit/test_main.py 2 locations

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