From 3876b5c3e0b22bb3ceb617f8518a6aec1845ea45 Mon Sep 17 00:00:00 2001 From: Bryan Brancotte <bryan.brancotte@pasteur.fr> Date: Tue, 8 Feb 2022 16:15:28 +0100 Subject: [PATCH] improve coverage --- .../tests/test_business_process.py | 11 +++++++++- .../viralhostrangedb/tests/test_other.py | 21 +++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 src/viralhostrange/viralhostrangedb/tests/test_other.py diff --git a/src/viralhostrange/viralhostrangedb/tests/test_business_process.py b/src/viralhostrange/viralhostrangedb/tests/test_business_process.py index b01a07d8..42348ebd 100644 --- a/src/viralhostrange/viralhostrangedb/tests/test_business_process.py +++ b/src/viralhostrange/viralhostrangedb/tests/test_business_process.py @@ -9,7 +9,7 @@ from django.test import TestCase from django.utils import timezone from viralhostrangedb import business_process, models -from viralhostrangedb.business_process import extract_name_and_identifiers, ImportationObserver +from viralhostrangedb.business_process import extract_name_and_identifiers, ImportationObserver, DataSourceAlteredData from viralhostrangedb.tests.test_views_others import ViewTestCase logger = logging.getLogger(__name__) @@ -669,6 +669,15 @@ class TestOthers(TestCase): self.assertEqual(name, expected_name) self.assertDictEqual(identifiers, expected_both_identifier_dict) + def test_backup_data_source(self): + self.assertRaises( + AssertionError, + business_process.backup_data_source, + user=None, + data_source=None, + altered_data=DataSourceAlteredData.ALL, + ) + class TestNCBIIdentifierStatus(TestCase): def test_biopython_ok(self): diff --git a/src/viralhostrange/viralhostrangedb/tests/test_other.py b/src/viralhostrange/viralhostrangedb/tests/test_other.py new file mode 100644 index 00000000..d08f6f0d --- /dev/null +++ b/src/viralhostrange/viralhostrangedb/tests/test_other.py @@ -0,0 +1,21 @@ +import logging + +from django.test import TestCase + +from viralhostrangedb import business_process + +logger = logging.getLogger(__name__) + + +class OnlyForCoverage(TestCase): + + def test_ImportationObserver(self): + class MyImportationObserver(business_process.ImportationObserver): + def notify_host_error(self, *args, **kwargs): + super().notify_host_error(*args, **kwargs) + + def notify_virus_error(self, *args, **kwargs): + super().notify_virus_error(*args, **kwargs) + + MyImportationObserver().notify_host_error(None, None) + MyImportationObserver().notify_virus_error(None, None) -- GitLab