Esempio n. 1
0
 def test_replace(content_a, content_b):
     myset = WiSet(name=self.name, sock=sock)
     myset.create()
     myset.insert_list(content_a)
     myset.update_content()
     for value in content_a:
         assert value in myset.content
     myset.replace_entries(content_b)
     myset.update_content()
     for (old, new) in zip(content_a, content_b):
         assert old not in myset.content
         assert new in myset.content
     myset.destroy()
Esempio n. 2
0
 def test_replace(content_a, content_b):
     myset = WiSet(name=self.name, sock=sock)
     myset.create()
     myset.insert_list(content_a)
     myset.update_content()
     for value in content_a:
         assert value in myset.content
     myset.replace_entries(content_b)
     myset.update_content()
     for (old, new) in zip(content_a, content_b):
         assert old not in myset.content
         assert new in myset.content
     myset.destroy()
Esempio n. 3
0
    def test_stats_consistency(self, sock=None):
        """ Test several way to fill the statistics of one IPSet """
        entries = ["1.2.3.4", "1.2.3.5", "1.2.3.6"]

        myset = WiSet(name=self.name, sock=sock)
        myset.create()
        myset.insert_list(entries)

        myset_lists = load_all_ipsets(sock=sock, content=True)[self.name]
        for value in entries:
            assert value in myset_lists.content

        myset_list = load_ipset(self.name, sock=sock, content=True)
        for value in entries:
            assert value in myset_list.content

        myset.destroy()
Esempio n. 4
0
    def test_stats_consistency(self, sock=None):
        """ Test several way to fill the statistics of one IPSet """
        entries = ["1.2.3.4", "1.2.3.5", "1.2.3.6"]

        myset = WiSet(name=self.name, sock=sock)
        myset.create()
        myset.insert_list(entries)

        myset_lists = load_all_ipsets(sock=sock, content=True)[self.name]
        for value in entries:
            assert value in myset_lists.content

        myset_list = load_ipset(self.name, sock=sock, content=True)
        for value in entries:
            assert value in myset_list.content

        myset.destroy()
Esempio n. 5
0
 def test_replace(content_a, content_b):
     myset = WiSet(name=self.name, sock=sock, comment=True)
     myset.create()
     myset.insert_list(content_a)
     myset.update_content()
     for value in content_a:
         assert value['entry'] in myset.content
         assert value['comment'] == (
             myset.content[value['entry']].comment)
     myset.replace_entries(content_b)
     myset.update_content()
     for value in content_a:
         assert value['entry'] not in myset.content
     for value in content_b:
         assert value['entry'] in myset.content
         assert value['comment'] == (
             myset.content[value['entry']].comment)
     myset.destroy()
Esempio n. 6
0
 def test_replace(content_a, content_b):
     myset = WiSet(name=self.name, sock=sock, comment=True)
     myset.create()
     myset.insert_list(content_a)
     myset.update_content()
     for value in content_a:
         assert value['entry'] in myset.content
         assert value['comment'] == (myset
                                     .content[value['entry']]
                                     .comment)
     myset.replace_entries(content_b)
     myset.update_content()
     for value in content_a:
         assert value['entry'] not in myset.content
     for value in content_b:
         assert value['entry'] in myset.content
         assert value['comment'] == (myset
                                     .content[value['entry']]
                                     .comment)
     myset.destroy()