Explorar o código

use of 'in' instead of '=' in nestedNamedQueries and additional Test in namedQueries

Roey Regev %!s(int64=6) %!d(string=hai) anos
pai
achega
6cfaff7999
Modificáronse 2 ficheiros con 6 adicións e 6 borrados
  1. 2 2
      code/Test/test_NamedQueries.py
  2. 4 4
      code/Test/test_NestedNamedQueries.py

+ 2 - 2
code/Test/test_NamedQueries.py

@@ -31,8 +31,8 @@ class UnitTestPyparsing(unittest.TestCase):
                          65535)
         self.assertEqual(controller.statistics.process_db_query('most_used(ipclass)'),
                          'A')
-       # self.assertEqual(controller.statistics.process_db_query('least_used(ipclass)'),
-        #                 ['A-private', 'C', 'C-private'])
+        self.assertEqual(controller.statistics.process_db_query('least_used(ipclass)'),
+                         ['A-private', 'C', 'C-private'])
         self.assertEqual(controller.statistics.process_db_query('avg(pktsreceived)'),
                          90.36363636363636)
         self.assertEqual(controller.statistics.process_db_query('avg(pktssent)'),

+ 4 - 4
code/Test/test_NestedNamedQueries.py

@@ -11,13 +11,13 @@ controller.load_pcap_statistics(flag_write_file=False, flag_recalculate_stats=Tr
 
 class UnitTestPyparsing(unittest.TestCase):
     def test_nested_query(self):
-        self.assertEqual(controller.statistics.process_db_query('macaddress(ipaddress=most_used(ipaddress))'),
+        self.assertEqual(controller.statistics.process_db_query('macaddress(ipaddress in most_used(ipaddress))'),
                          '08:00:27:a3:83:43')
-        self.assertEqual(controller.statistics.process_db_query('macaddress(ipaddress=least_used(ipaddress))'),
+        self.assertEqual(controller.statistics.process_db_query('macaddress(ipaddress in least_used(ipaddress))'),
                          '52:54:00:12:35:02')
-        self.assertEqual(controller.statistics.process_db_query('ipaddress(macaddress=least_used(macaddress))'),
+        self.assertEqual(controller.statistics.process_db_query('ipaddress(macaddress in least_used(macaddress))'),
                          '10.0.2.15')
-        self.assertEqual(controller.statistics.process_db_query('ipaddress(macaddress=most_used(macaddress))'),
+        self.assertEqual(controller.statistics.process_db_query('ipaddress(macaddress in most_used(macaddress))'),
                          ['104.83.103.45',
                           '13.107.21.200',
                           '131.253.61.100',