From d15ca98447e920207eca748e8c8898e482046d08 Mon Sep 17 00:00:00 2001 From: bkfox Date: Wed, 21 Jun 2023 01:37:45 +0200 Subject: [PATCH] mockup test files --- aircox/controllers/README.md | 2 +- aircox/tests/controllers/test_diffusions.py | 19 ++++++++ aircox/tests/controllers/test_log_archiver.py | 37 +++++++++++++++ .../tests/controllers/test_playlist_import.py | 22 +++++++++ .../test_sound_file.py | 0 .../tests/controllers/test_sound_monitor.py | 37 ++++++++++++--- aircox/tests/controllers/test_sound_stats.py | 47 +++++++++++++++++++ 7 files changed, 156 insertions(+), 8 deletions(-) create mode 100644 aircox/tests/controllers/test_diffusions.py create mode 100644 aircox/tests/controllers/test_log_archiver.py create mode 100644 aircox/tests/controllers/test_playlist_import.py rename aircox/tests/{management => controllers}/test_sound_file.py (100%) create mode 100644 aircox/tests/controllers/test_sound_stats.py diff --git a/aircox/controllers/README.md b/aircox/controllers/README.md index 0747843..73df8e1 100644 --- a/aircox/controllers/README.md +++ b/aircox/controllers/README.md @@ -1,6 +1,6 @@ # aircox.controllers This module provides the following controllers classes: -- `log_archiver.LogArchive`: dumps and load gzip archives from Log models. +- `log_archiver.LogArchiver`: dumps and load gzip archives from Log models. - `sound_file.SoundFile`: handle synchronisation between filesystem and database for a sound file. - `sound_monitor.SoundMonitor`: monitor filesystem for changes on audio files and synchronise database. - `sound_stats.SoundStats` (+ `SoxStats`): get audio statistics of an audio file using Sox. diff --git a/aircox/tests/controllers/test_diffusions.py b/aircox/tests/controllers/test_diffusions.py new file mode 100644 index 0000000..dc4a153 --- /dev/null +++ b/aircox/tests/controllers/test_diffusions.py @@ -0,0 +1,19 @@ +import pytest + +from aircox.controllers.diffusions import Diffusions + + +@pytest.fixture +def diffusions(): + return Diffusions + + +class TestDiffusion: + def test___init__(self): + pass + + def test_update(self): + pass + + def test_clean(self): + pass diff --git a/aircox/tests/controllers/test_log_archiver.py b/aircox/tests/controllers/test_log_archiver.py new file mode 100644 index 0000000..dd9d1ff --- /dev/null +++ b/aircox/tests/controllers/test_log_archiver.py @@ -0,0 +1,37 @@ +import pytest + +from aircox.controllers.log_archiver import LogArchiver + + +@pytest.fixture +def log_archiver(): + return LogArchiver() + + +class TestLogArchiver: + def test_get_path(self): + pass + + def test_archive(self): + pass + + def test_archive_no_qs(self): + pass + + def test_archive_not_keep(self): + pass + + def test_sort_log(self): + pass + + def test_serialize(self): + pass + + def test_load(self): + pass + + def test_load_file_not_exists(self): + pass + + def test_get_relations(self): + pass diff --git a/aircox/tests/controllers/test_playlist_import.py b/aircox/tests/controllers/test_playlist_import.py new file mode 100644 index 0000000..257272f --- /dev/null +++ b/aircox/tests/controllers/test_playlist_import.py @@ -0,0 +1,22 @@ +import pytest + +from aircox.controller.playlist_import import PlaylistImport + + +@pytest.fixture +def playlist_import(): + return PlaylistImport() + + +class TestPlaylistImport: + def test_reset(self): + pass + + def test_run(self): + pass + + def test_read(self): + pass + + def make_playlist(self): + pass diff --git a/aircox/tests/management/test_sound_file.py b/aircox/tests/controllers/test_sound_file.py similarity index 100% rename from aircox/tests/management/test_sound_file.py rename to aircox/tests/controllers/test_sound_file.py diff --git a/aircox/tests/controllers/test_sound_monitor.py b/aircox/tests/controllers/test_sound_monitor.py index ec6e70a..543cfea 100644 --- a/aircox/tests/controllers/test_sound_monitor.py +++ b/aircox/tests/controllers/test_sound_monitor.py @@ -5,7 +5,7 @@ from django.utils import timezone as tz from aircox.models import Sound from aircox.controllers import sound_monitor -from aircox.test import Interface +from aircox.test import Interface, interface now = tz.datetime.now() @@ -21,7 +21,6 @@ def logger(): logger = Interface( logging, {"info": None, "debug": None, "error": None, "warning": None} ) - print("logger", logger) return logger @@ -73,7 +72,6 @@ class TestTask: def test_ping(self, task): task.timestamp = None task.ping() - print("---", task.timestamp, now) assert task.timestamp >= now @pytest.mark.django_db @@ -124,13 +122,38 @@ class TestModifiedTask: datetime._imeta.release() - def test__call__(self): - pass + def test__call__(self, modified_task, event): + interface(modified_task, {"wait": None}) + modified_task(event) + assert modified_task.calls["wait"] class TestMonitorHandler: - pass + def test_monitor___init__(self): + pass + + def test_on_created(self): + pass + + def test_on_deleted(self): + pass + + def test_on_moved(self): + pass + + def test_on_modified(self): + pass + + def test__submit(self): + pass class SoundMonitor: - pass + def test_report(self): + pass + + def test_scan(self): + pass + + def test_monitor(self): + pass diff --git a/aircox/tests/controllers/test_sound_stats.py b/aircox/tests/controllers/test_sound_stats.py new file mode 100644 index 0000000..feacae1 --- /dev/null +++ b/aircox/tests/controllers/test_sound_stats.py @@ -0,0 +1,47 @@ +import pytest + +from aircox.controllers.sound_stats import SoxStats, SoundStats + + +@pytest.fixture +def sox_stats(): + return SoxStats() + + +@pytest.fixture +def sound_stats(): + return SoundStats() + + +class TestSoxStats: + def test___init__(self): + pass + + def test_get(self): + pass + + def test_parse(self): + pass + + def test_analyse(self): + pass + + +class TestSoundStats: + def test___init__(self): + pass + + def test_get_file_stats(self): + pass + + def test_analyze(self): + pass + + def test_analyze_no_sample_length(self): + pass + + def test_check(self): + pass + + def test_resume(self): + pass