-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DBC22-1831: improved backend unit test coverage to 95%
DBC22-1831: improved backend unit test coverage to 95%
- Loading branch information
1 parent
9825585
commit 454e40e
Showing
24 changed files
with
3,651 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from django.test import TestCase | ||
from django.templatetags.static import static | ||
from django.utils.html import format_html | ||
from wagtail import hooks | ||
|
||
class WagtailHookTest(TestCase): | ||
|
||
def test_insert_global_admin_css(self): | ||
# Call the hook function to get the HTML content | ||
hook_name = 'insert_global_admin_css' | ||
callbacks = hooks.get_hooks(hook_name) | ||
|
||
# Verify that there is at least one callback registered | ||
self.assertGreater(len(callbacks), 0) | ||
|
||
# Call each callback and verify the HTML content | ||
for callback in callbacks: | ||
result = callback() | ||
|
||
expected_css_link = format_html( | ||
'<link rel="stylesheet" type="text/css" href="{}">', | ||
static("wagtail_admin.css"), | ||
) | ||
self.assertIn(result, expected_css_link) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
src/backend/apps/event/tests/test_data/event_feed_list_of_one.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{ | ||
"events": [ | ||
{ | ||
"id": "drivebc.ca/DBC-3175", | ||
"display_category": "minorEvents", | ||
"direction_display": "Not Applicable", | ||
"route_display": "Pritchard Rd", | ||
"schedule": { | ||
"intervals": [ | ||
"2023-09-20T18:13/" | ||
] | ||
}, | ||
"severity": "MINOR", | ||
"description": "Highway 3. Collision between Pritchard Rd and Abbey Pit Rd (17 km east of Cranbrook). Last updated Wed Sep 20 at 11:13 AM MDT. (DBC-3175)", | ||
"event_type": "INCIDENT", | ||
"event_sub_type": "HAZARD", | ||
"status": "ACTIVE", | ||
"closed": false, | ||
"direction": "NONE", | ||
"location": { | ||
"type": "Point", | ||
"coordinates": [ | ||
-115.583567, | ||
49.50658 | ||
] | ||
}, | ||
"route_at": "Highway 3", | ||
"route_from": "Pritchard Rd", | ||
"route_to": "", | ||
"first_created": "2018-11-14T09:06:41-08:00", | ||
"last_updated": "2023-09-20T11:13:56-07:00", | ||
"start": "2023-09-20T18:13", | ||
"end": "2023-10-20T18:13", | ||
"priority": 7 | ||
} | ||
], | ||
"pagination": { | ||
"offset": "0" | ||
}, | ||
"meta": { | ||
"url": "/events", | ||
"up_url": "", | ||
"version": "v1" | ||
} | ||
} |
182 changes: 182 additions & 0 deletions
182
src/backend/apps/event/tests/test_data/event_feed_list_of_one_filtered.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,182 @@ | ||
{ | ||
"events": [ | ||
{ | ||
"id": "drivebc.ca/DBC-20066", | ||
"display_category": "roadConditions", | ||
"direction_display": "Not Applicable", | ||
"route_display": "Exit 109: Yale Rd to Exit 120: Young Rd", | ||
"schedule": { | ||
"intervals": [ | ||
"2024-01-30T01:00/2025-01-30T01:00" | ||
] | ||
}, | ||
"severity": "MAJOR", | ||
"description": "Highway 1 (TransCanada Highway). Watch for slippery sections between Exit 109: Yale Rd and Exit 120: Young Rd for 7.7 km (Chilliwack). Until Wed Jan 29, 2025 at 5:00 PM PST. Next update time Wed Jan 29, 2025 at 4:45 PM PST. Last updated Tue Jan 30 at 8:31 AM PST. (DBC-20066)", | ||
"event_type": "ROAD_CONDITION", | ||
"event_sub_type": "PARTLY_ICY", | ||
"status": "ACTIVE", | ||
"closed": false, | ||
"direction": "NONE", | ||
"location": { | ||
"type": "LineString", | ||
"coordinates": [ | ||
[ | ||
-122.063019, | ||
49.137886 | ||
], | ||
[ | ||
-122.060004, | ||
49.138325 | ||
], | ||
[ | ||
-122.05868, | ||
49.138518 | ||
], | ||
[ | ||
-122.039974, | ||
49.140932 | ||
], | ||
[ | ||
-122.02876, | ||
49.142377 | ||
], | ||
[ | ||
-122.027027, | ||
49.142632 | ||
], | ||
[ | ||
-122.025373, | ||
49.142998 | ||
], | ||
[ | ||
-122.022035, | ||
49.143963 | ||
], | ||
[ | ||
-122.020949, | ||
49.144189 | ||
], | ||
[ | ||
-122.020039, | ||
49.144322 | ||
], | ||
[ | ||
-122.0189, | ||
49.144415 | ||
], | ||
[ | ||
-122.01753, | ||
49.144438 | ||
], | ||
[ | ||
-122.0117, | ||
49.144303 | ||
], | ||
[ | ||
-122.006977, | ||
49.144219 | ||
], | ||
[ | ||
-122.006907, | ||
49.144219 | ||
], | ||
[ | ||
-122.003081, | ||
49.144157 | ||
], | ||
[ | ||
-121.999997, | ||
49.144107 | ||
], | ||
[ | ||
-121.999873, | ||
49.144105 | ||
], | ||
[ | ||
-121.99975, | ||
49.144103 | ||
], | ||
[ | ||
-121.999572, | ||
49.1441 | ||
], | ||
[ | ||
-121.999088, | ||
49.144092 | ||
], | ||
[ | ||
-121.983239, | ||
49.143787 | ||
], | ||
[ | ||
-121.977708, | ||
49.143681 | ||
], | ||
[ | ||
-121.977602, | ||
49.14368 | ||
], | ||
[ | ||
-121.969274, | ||
49.14352 | ||
], | ||
[ | ||
-121.967859, | ||
49.143585 | ||
], | ||
[ | ||
-121.967236, | ||
49.143653 | ||
], | ||
[ | ||
-121.965676, | ||
49.143902 | ||
], | ||
[ | ||
-121.964755, | ||
49.144076 | ||
], | ||
[ | ||
-121.964486, | ||
49.144142 | ||
], | ||
[ | ||
-121.962445, | ||
49.144643 | ||
], | ||
[ | ||
-121.962149, | ||
49.144716 | ||
], | ||
[ | ||
-121.961942, | ||
49.144767 | ||
], | ||
[ | ||
-121.961366, | ||
49.144906 | ||
], | ||
[ | ||
-121.961083, | ||
49.144974 | ||
] | ||
] | ||
}, | ||
"route_at": "Highway 1", | ||
"route_from": "Exit 109: Yale Rd", | ||
"route_to": "Exit 120: Young Rd", | ||
"first_created": "2024-01-29T16:55:13-08:00", | ||
"last_updated": "2024-01-30T08:31:32-08:00", | ||
"start": "2024-01-30T01:00", | ||
"end": "2025-01-30T01:00" | ||
} | ||
], | ||
"pagination": { | ||
"offset": "0" | ||
}, | ||
"meta": { | ||
"url": "/events", | ||
"up_url": "", | ||
"version": "v1" | ||
} | ||
} |
Oops, something went wrong.