|
@@ 101-122 (lines=22) @@
|
| 98 |
|
'Start in the past not allowed' |
| 99 |
|
self.scheduler.add.assert_not_called() |
| 100 |
|
|
| 101 |
|
async def test_create_mw_case_4(self): |
| 102 |
|
"""Test a fail case of the REST to create a maintenance window.""" |
| 103 |
|
url = f'{self.base_endpoint}' |
| 104 |
|
start = datetime.now(pytz.utc) + timedelta(days=1) |
| 105 |
|
end = start - timedelta(hours=2) |
| 106 |
|
payload = { |
| 107 |
|
"start": start.strftime(TIME_FMT), |
| 108 |
|
"end": end.strftime(TIME_FMT), |
| 109 |
|
"switches": [ |
| 110 |
|
"00:00:00:00:00:00:02", |
| 111 |
|
], |
| 112 |
|
'interfaces': [ |
| 113 |
|
"00:00:00:00:00:00:00:03:3", |
| 114 |
|
], |
| 115 |
|
} |
| 116 |
|
response = await self.api.post(url, json=payload) |
| 117 |
|
current_data = response.json() |
| 118 |
|
|
| 119 |
|
assert response.status_code == 400 |
| 120 |
|
assert current_data['description'] == \ |
| 121 |
|
'End before start not allowed' |
| 122 |
|
self.scheduler.add.assert_not_called() |
| 123 |
|
|
| 124 |
|
async def test_get_mw_case_1(self): |
| 125 |
|
"""Test get all maintenance windows, empty list.""" |
|
@@ 79-99 (lines=21) @@
|
| 76 |
|
assert response.status_code == 400 |
| 77 |
|
self.scheduler.add.assert_not_called() |
| 78 |
|
|
| 79 |
|
async def test_create_mw_case_3(self): |
| 80 |
|
"""Test a fail case of the REST to create a maintenance window.""" |
| 81 |
|
url = f'{self.base_endpoint}' |
| 82 |
|
start = datetime.now(pytz.utc) - timedelta(days=1) |
| 83 |
|
end = start + timedelta(hours=2) |
| 84 |
|
payload = { |
| 85 |
|
"start": start.strftime(TIME_FMT), |
| 86 |
|
"end": end.strftime(TIME_FMT), |
| 87 |
|
"switches": [ |
| 88 |
|
"00:00:00:00:00:00:02", |
| 89 |
|
], |
| 90 |
|
'interfaces': [ |
| 91 |
|
"00:00:00:00:00:00:00:03:3", |
| 92 |
|
], |
| 93 |
|
} |
| 94 |
|
response = await self.api.post(url, json=payload) |
| 95 |
|
current_data = response.json() |
| 96 |
|
assert response.status_code == 400 |
| 97 |
|
assert current_data['description'] == \ |
| 98 |
|
'Start in the past not allowed' |
| 99 |
|
self.scheduler.add.assert_not_called() |
| 100 |
|
|
| 101 |
|
async def test_create_mw_case_4(self): |
| 102 |
|
"""Test a fail case of the REST to create a maintenance window.""" |