Skip to content

Commit

Permalink
removed severity from scheduled maintenance #88
Browse files Browse the repository at this point in the history
  • Loading branch information
MatteoGuarnaccia5 committed Jun 24, 2024
1 parent 8cc1673 commit 909b6f9
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 9 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,6 @@ The `maintenance` folder at the root of the project directory contains two json
index number of the file. A workaround is to create a new file using the `maintenance.json` or `scheduled_maintenance.json` file, apply your changes
in the new file, and then overwrite the `maintenance.json` / `scheduled_maintenance.json` file with the content of the new file, see below an example for `maintenance.json` file.

**_The `severity` in `scheduled_maintenance.json` should be one of the following values: `'success' | 'warning' | 'error' | 'information'`_**

```bash
cp maintenance/maintenance.json new_maintenance.json
vim new_maintenance.json
Expand Down
3 changes: 1 addition & 2 deletions ldap_jwt_auth/core/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,4 @@ class ScheduledMaintenanceState(MaintenanceState):
"""
Model for scheduled maintenance state
"""

severity: Optional[str]

3 changes: 1 addition & 2 deletions maintenance/scheduled_maintenance.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"show": false,
"message": "Maintenance scheduled for tomorrow at 12:00",
"severity": "warning"
"message": "Maintenance scheduled for tomorrow at 12:00"
}
5 changes: 2 additions & 3 deletions test/unit/maintenance/test_maintenance.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def test_get_scheduled_maintenance_state():
"""
Test returning scheduled maintenance state schema
"""
mock_scheduled_maintenance_data = {"show": True, "message": "This is a test message", "severity": "important"}
mock_scheduled_maintenance_data = {"show": True, "message": "This is a test message"}
mock_scheduled_maintenance_file = json.dumps(mock_scheduled_maintenance_data)

with (
Expand All @@ -71,14 +71,13 @@ def test_get_scheduled_maintenance_state():

assert response.show is True
assert response.message == "This is a test message"
assert response.severity == "important"


def test_get_scheduled_maintenance_state_invalid_file():
"""
Test returning scheduled maintenance state schema when file is invalid
"""
mock_scheduled_maintenance_data = {"show": "True", "message": "This is a test message", "severity": True}
mock_scheduled_maintenance_data = {"show": "True", "message": "This is a test message"}
mock_scheduled_maintenance_file = json.dumps(mock_scheduled_maintenance_data)

with (
Expand Down

0 comments on commit 909b6f9

Please sign in to comment.