Beispiel #1
0
 def test_token_to_ip_fail(self):
     expected_results = [(r'GOOGLE_DNS', [
         nacaddr.IPv4('69.171.239.12/32'),
         nacaddr.IPv6('2a03:2880:fffe:c:face:b00c:0:35/128')
     ])]
     options = Namespace()
     options.obj = ('GOOGLE_DNS', )
     results = cgrep.get_nets(options.obj, self.db)
     # the network object name should match, but not the IPs contained within
     self.assertEquals(results[0][0], expected_results[0][0])
     self.assertNotEquals(set(results[0][1]), set(expected_results[0][1]))
Beispiel #2
0
    def test_token_to_ips(self):
        expected_results = [(r'GOOGLE_DNS', [
            nacaddr.IPv4('8.8.4.4/32'),
            nacaddr.IPv4('8.8.8.8/32'),
            nacaddr.IPv6('2001:4860:4860::8844/128'),
            nacaddr.IPv6('2001:4860:4860::8888/128')
        ])]
        options = Namespace()
        options.obj = ('GOOGLE_DNS', )

        results = cgrep.get_nets(options.obj, self.db)
        self.assertEquals(results[0][0], expected_results[0][0])
        self.assertEquals(set(results[0][1]), set(expected_results[0][1]))
Beispiel #3
0
 def test_token_to_ip_fail(self):
   expected_results = [
       (
           r'GOOGLE_DNS',
           [
               nacaddr.IPv4('69.171.239.12/32'),
               nacaddr.IPv6('2a03:2880:fffe:c:face:b00c:0:35/128')
           ]
       )
   ]
   options = Namespace()
   options.obj = ('GOOGLE_DNS',)
   results = cgrep.get_nets(options.obj, self.db)
   # the network object name should match, but not the IPs contained within
   self.assertEquals(results[0][0], expected_results[0][0])
   self.assertNotEquals(set(results[0][1]), set(expected_results[0][1]))
Beispiel #4
0
  def test_token_to_ips(self):
    expected_results = [
        (
            r'GOOGLE_DNS',
            [
                nacaddr.IPv4('8.8.4.4/32'),
                nacaddr.IPv4('8.8.8.8/32'),
                nacaddr.IPv6('2001:4860:4860::8844/128'),
                nacaddr.IPv6('2001:4860:4860::8888/128')
            ]
        )
    ]
    options = Namespace()
    options.obj = ('GOOGLE_DNS',)

    results = cgrep.get_nets(options.obj, self.db)
    self.assertEquals(results[0][0], expected_results[0][0])
    self.assertEquals(set(results[0][1]), set(expected_results[0][1]))