diff options
author | jelle van der Waa <jelle@vdwaa.nl> | 2018-11-30 21:07:20 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-30 21:07:20 +0100 |
commit | bc57810d4d1894a30afaef92a535db8ea4a087a3 (patch) | |
tree | a013ab3ab53e0809f39fa116f6f4dddcf222226f | |
parent | 469315893d07a79bab2c198bd4fbc74506778c9c (diff) | |
parent | 4572b1f3a7afd12033cd55f1f610443604274934 (diff) | |
download | archweb-bc57810d4d1894a30afaef92a535db8ea4a087a3.tar.gz archweb-bc57810d4d1894a30afaef92a535db8ea4a087a3.zip |
Merge pull request #165 from jelly/tests_cov2
Tests coverage
-rw-r--r-- | devel/tests/test_pgp_import.py | 12 | ||||
-rw-r--r-- | devel/tests/test_rematch_developers.py | 2 | ||||
-rw-r--r-- | mirrors/tests/test_mirrorcheck.py | 16 |
3 files changed, 28 insertions, 2 deletions
diff --git a/devel/tests/test_pgp_import.py b/devel/tests/test_pgp_import.py new file mode 100644 index 00000000..2b41b980 --- /dev/null +++ b/devel/tests/test_pgp_import.py @@ -0,0 +1,12 @@ +from django.core.management import call_command +from django.core.management.base import CommandError +from django.test import TransactionTestCase + + +class PGPImportTest(TransactionTestCase): + fixtures = ['main/fixtures/arches.json', 'main/fixtures/repos.json'] + + def test_pgp_import(self): + with self.assertRaises(CommandError) as e: + call_command('pgp_import') + self.assertIn('keyring_path', str(e.exception)) diff --git a/devel/tests/test_rematch_developers.py b/devel/tests/test_rematch_developers.py index 46671041..395cb63d 100644 --- a/devel/tests/test_rematch_developers.py +++ b/devel/tests/test_rematch_developers.py @@ -5,7 +5,7 @@ from django.core.management import call_command from django.test import TransactionTestCase -class RepoReadTest(TransactionTestCase): +class RematchDeveloperTest(TransactionTestCase): fixtures = ['main/fixtures/arches.json', 'main/fixtures/repos.json'] def test_rematch_developers(self): diff --git a/mirrors/tests/test_mirrorcheck.py b/mirrors/tests/test_mirrorcheck.py index 1f22d1c5..77828363 100644 --- a/mirrors/tests/test_mirrorcheck.py +++ b/mirrors/tests/test_mirrorcheck.py @@ -11,7 +11,7 @@ from django.core.management import call_command from mirrors.tests import create_mirror_url -from mirrors.models import MirrorLog +from mirrors.models import MirrorLog, CheckLocation class MirrorCheckTest(TestCase): @@ -56,3 +56,17 @@ class MirrorCheckTest(TestCase): MirrorLog.objects.create(url=self.mirror_url, check_time=date) call_command('mirrorcheck') self.assertEqual(len(MirrorLog.objects.all()), 1) + + def test_checklocation(self): + with self.assertRaises(CheckLocation.DoesNotExist) as e: + call_command('mirrorcheck', '-l', '1') + self.assertEqual('CheckLocation matching query does not exist.', str(e.exception)) + + def test_checklocation_model(self): + checkloc = CheckLocation.objects.create(hostname='archlinux.org', + source_ip='1.1.1.1') + with mock.patch('mirrors.management.commands.mirrorcheck.logger') as logger: + call_command('mirrorcheck', '-l', '1') + logger.info.assert_called() + + checkloc.delete() |