summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJelle van der Waa <jelle@vdwaa.nl>2018-11-30 20:51:33 +0100
committerJelle van der Waa <jelle@vdwaa.nl>2018-11-30 20:51:33 +0100
commit4e08437a3307192eaa8b8282cf46ca8b859c6b38 (patch)
tree3b6dc2b21db0fc496feca1848aa1370e19ca5303
parentc51bfe07f4350e24a7014382d9c7a3d21f60ff9a (diff)
downloadarchweb-4e08437a3307192eaa8b8282cf46ca8b859c6b38.tar.gz
archweb-4e08437a3307192eaa8b8282cf46ca8b859c6b38.zip
mirrors: add CheckLocation check
-rw-r--r--mirrors/tests/test_mirrorcheck.py16
1 files changed, 15 insertions, 1 deletions
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()