Example #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()
Example #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()
Example #3
0
    def test_hashnet_with_comment(self, sock=None):
        comment = "abcdef"
        myset = WiSet(name=self.name, attr_type="hash:net", comment=True,
                      sock=sock)
        myset.create()

        inherit_sock = sock is not None
        myset = load_ipset(self.name, sock=sock,
                           inherit_sock=inherit_sock)
        assert myset.comment

        myset.add("192.168.1.1", comment=comment)
        myset.update_content()

        assert myset.content["192.168.1.1/32"].comment == comment

        myset.destroy()
Example #4
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()
Example #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()