def test_excludes_all_ips_failure(self):
     """
     :class:`ExcludesAllIPs` fails when the nodes contain any or all of
     the IPs given.
     """
     matcher = ExcludesAllIPs(['10.0.0.1', '10.0.0.2'])
     self.assertNotEqual(
         None,
         matcher.match([{'id': i, 'address': '10.0.0.{0}'.format(i)}
                        for i in (1, 2)]),
         "Complete match succeeds when none should be present."
     )
     self.assertNotEqual(
         None,
         matcher.match([{'id': 1, 'address': '10.0.0.1'}]),
         "Partial match succeeds when none should be present."
     )
Beispiel #2
0
 def test_excludes_all_ips_failure(self):
     """
     :class:`ExcludesAllIPs` fails when the nodes contain any or all of
     the IPs given.
     """
     matcher = ExcludesAllIPs(['10.0.0.1', '10.0.0.2'])
     self.assertNotEqual(
         None,
         matcher.match([{
             'id': i,
             'address': '10.0.0.{0}'.format(i)
         } for i in (1, 2)]),
         "Complete match succeeds when none should be present.")
     self.assertNotEqual(
         None, matcher.match([{
             'id': 1,
             'address': '10.0.0.1'
         }]), "Partial match succeeds when none should be present.")
 def test_excludes_all_ips_success(self):
     """
     :class:`ExcludesAllIPs` succeeds when the nodes do not contain any of
     the IPs given.
     """
     matcher = ExcludesAllIPs(['10.0.0.1', '10.0.0.1'])
     mismatch = matcher.match([
         {'id': i, 'address': '10.0.0.{0}'.format(i)}
         for i in (2, 3)
     ])
     self.assertEqual(None, mismatch)
Beispiel #4
0
 def test_excludes_all_ips_success(self):
     """
     :class:`ExcludesAllIPs` succeeds when the nodes do not contain any of
     the IPs given.
     """
     matcher = ExcludesAllIPs(['10.0.0.1', '10.0.0.1'])
     mismatch = matcher.match([{
         'id': i,
         'address': '10.0.0.{0}'.format(i)
     } for i in (2, 3)])
     self.assertEqual(None, mismatch)