-
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-1857 Augment task to copy webcam images locally
- Loading branch information
Showing
18 changed files
with
1,268 additions
and
10 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
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
13 changes: 13 additions & 0 deletions
13
src/backend/apps/webcam/management/commands/update_webcam.py
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,13 @@ | ||
from apps.webcam.tasks import update_single_webcam_data | ||
from django.core.management.base import BaseCommand | ||
|
||
from apps.webcam.models import Webcam | ||
|
||
class Command(BaseCommand): | ||
|
||
def add_arguments(self , parser): | ||
parser.add_argument('id' , nargs='?' , type=int) | ||
|
||
def handle(self, id, *args, **options): | ||
cam = Webcam.objects.get(id=id) | ||
update_single_webcam_data(cam) |
Binary file not shown.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions
20
src/backend/apps/webcam/tests/test_webcam_update_images.py
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,20 @@ | ||
import datetime | ||
import json | ||
import zoneinfo | ||
from pathlib import Path | ||
from unittest.mock import patch | ||
|
||
from apps.shared import enums as shared_enums | ||
from apps.shared.enums import CacheKey | ||
from apps.shared.tests import BaseTest, MockResponse | ||
from apps.webcam.models import Webcam | ||
from apps.webcam.views import WebcamAPI | ||
from django.contrib.gis.geos import Point | ||
from django.core.cache import cache | ||
from rest_framework.test import APITestCase | ||
|
||
|
||
class TestWebcamUpdateImages(BaseTest): | ||
|
||
def test_webcam_image_update(self): | ||
pass |
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 |
---|---|---|
|
@@ -179,3 +179,5 @@ | |
"level": "WARNING", | ||
}, | ||
} | ||
|
||
TEST_RUNNER = env("TEST_RUNNER", default="django.test.runner.DiscoverRunner") |
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,28 @@ | ||
from argparse import ArgumentParser | ||
from typing import Any | ||
from django.db.backends.base.base import BaseDatabaseWrapper | ||
from django.test.runner import DiscoverRunner | ||
|
||
|
||
class DbcRunner(DiscoverRunner): | ||
'''Custom test runner to allow for skipping database creation altogether.''' | ||
|
||
def __init__(self, *args, **kwargs): | ||
self.skipdb = kwargs["skipdb"] | ||
super().__init__(*args, **kwargs) | ||
|
||
@classmethod | ||
def add_arguments(cls, parser: ArgumentParser) -> None: | ||
parser.add_argument("--skipdb", action="store_true", default=False, | ||
help="Don't create a test database") | ||
DiscoverRunner.add_arguments(parser) | ||
|
||
def setup_databases(self, **kwargs: Any) -> list[tuple[BaseDatabaseWrapper, str, bool]]: | ||
if self.skipdb: | ||
return | ||
return super().setup_databases(**kwargs) | ||
|
||
def teardown_databases(self, old_config: list[tuple[BaseDatabaseWrapper, str, bool]], **kwargs: Any) -> None: | ||
if self.skipdb: | ||
return | ||
return super().teardown_databases(old_config, **kwargs) |
Oops, something went wrong.