From 9a94e0095a51981cc668ac0269667a307c45923c Mon Sep 17 00:00:00 2001 From: Christian Franke Date: Wed, 11 Jan 2012 09:49:53 +0100 Subject: add network_monitor --- sublab_project/sublab_monitor/tests.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 sublab_project/sublab_monitor/tests.py (limited to 'sublab_project/sublab_monitor/tests.py') 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) -- cgit v1.2.1