diff options
Diffstat (limited to 'sublab_project/sublab_monitor/tests.py')
-rw-r--r-- | sublab_project/sublab_monitor/tests.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/sublab_project/sublab_monitor/tests.py b/sublab_project/sublab_monitor/tests.py new file mode 100644 index 0000000..c80bb61 --- /dev/null +++ b/sublab_project/sublab_monitor/tests.py @@ -0,0 +1,24 @@ +""" +This file demonstrates writing tests using the unittest module. These will pass +when you run "manage.py test". + +Replace this with more appropriate tests for your application. +""" + +from django.test import TestCase +from sublab_monitor.tasks import NetworkStatus + +class SimpleTest(TestCase): + def test_reachable(self): + """ + Tests that for reachable hosts host_alive() returns True + """ + self.assertEqual(NetworkStatus.host_alive('127.0.0.1'), True) + + def test_unreachable(self): + """ + Tests that for unreachable hosts host_alive() returns False + """ + # Hopefully, this DoD? IP will never be reachable on the + # Internet :) + self.assertEqual(NetworkStatus.host_alive('8.5.4.3'), False) |