summaryrefslogtreecommitdiff
path: root/sublab_project/sublab_monitor/tests.py
blob: c80bb6103f8a0b8805729b6c183b8598577cfb48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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)