Esempio n. 1
0
    def test_add_host(self):

        hive = Hive(self.host, self.db)

        for x in right_host:
            self.assertEqual(hive.add_host(x), True, x)

        for y in wrong_host:
            self.assertEqual(hive.add_host(y), False, y)
Esempio n. 2
0
from models import Hive

if __name__ == '__main__':

    net1 = "192.168.23.0/24"
    net2 = "192.168.24.0/24"

    host1 = "192.168.23.25"

    hive = Hive('192.168.149.138')

    # Must be TRUE
    print(hive.add_network(net1))
    # FALSE
    print(hive.add_host(net2))

    # FALSE
    print(hive.add_network(host1))
    # TRUE
    print(hive.add_host(host1))