Code Duplication    Length = 22-24 lines in 2 locations

tests/unit/test_main.py 2 locations

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