Exemple #1
0
    def test_ret_val(self):
        net = ParseNetxml(get_asset_dic() + "/network.netxml")

        self.assertEqual(0, net._ret_val(0, ""))
        self.assertEqual(5, net._ret_val(0, "5"))
        self.assertEqual(10, net._ret_val(0, 10))

        self.assertEqual(.0, net._ret_val(.0, ""))
        self.assertEqual(.2, net._ret_val(.0, "0.2"))
        self.assertEqual(.5, net._ret_val(.0, .5))

        self.assertEqual(True, net._ret_val(True, ""))
        self.assertEqual(True, net._ret_val(True, True))
        self.assertEqual(True, net._ret_val(True, "true"))
        self.assertEqual(True, net._ret_val(True, False))
        self.assertEqual(False, net._ret_val(True, "false"))

        self.assertEqual(False, net._ret_val(False, ""))
        self.assertEqual(True, net._ret_val(False, True))
        self.assertEqual(True, net._ret_val(False, "true"))
        self.assertEqual(False, net._ret_val(False, False))
        self.assertEqual(False, net._ret_val(False, "false"))

        self.assertEqual("", net._ret_val("", None))
        self.assertEqual("", net._ret_val("", ""))
        self.assertEqual("0", net._ret_val("", "0"))
        self.assertEqual("def", net._ret_val("def", None))
        self.assertEqual("def", net._ret_val("def", ""))
        self.assertEqual("TeST", net._ret_val("", "TeST"))
Exemple #2
0
    def test_metadata(self):
        net = ParseNetxml(get_asset_dic() + "/network.netxml")
        meta = net.get_metadata()

        self.assertDictEqual(meta, {
            "kismet_version": "2013.03.R0",
            "start_time": "2014-11-15 13:00:00"
        })
Exemple #3
0
    def test_get_networks(self):
        self.maxDiff = None

        net = ParseNetxml(get_asset_dic() + "/network.netxml")

        data = []

        for i in net.get_networks():
            data.append(i)

        expected = ""
        with open(get_asset_dic() + "/network.netxml.json") as f:
            expected = json.loads(f.read())

        self.assertListEqual(expected, data)