Ejemplo n.º 1
0
 def test_equivalent_network(self):
     """If a hostname is specified in the config file, we use it."""
     with mock.patch.object(config, "_CONFIG", self.config):
         client = api.Client(authenticate=False)
         src = Source(
             source_type="network",
             name=MOCK_SOURCE["name"],
             hosts=MOCK_SOURCE["hosts"],
             credential_ids=[MOCK_SOURCE["credentials"][0]["id"]],
             client=client,
         )
         src._id = MOCK_SOURCE["id"]
         self.assertTrue(src.equivalent(MOCK_SOURCE))
         self.assertTrue(src.equivalent(src))
         with self.assertRaises(TypeError):
             src.equivalent([])
Ejemplo n.º 2
0
 def test_equivalent_satellite(self):
     """If a hostname is specified in the config file, we use it."""
     with mock.patch.object(config, "_CONFIG", self.config):
         client = api.Client(authenticate=False)
         p = Source(
             source_type="satellite",
             name=MOCK_SAT6_SOURCE["name"],
             hosts=MOCK_SAT6_SOURCE["hosts"],
             credential_ids=[MOCK_SAT6_SOURCE["credentials"][0]["id"]],
             options=MOCK_SAT6_SOURCE["options"],
             port=443,
             client=client,
         )
         p._id = MOCK_SAT6_SOURCE["id"]
         self.assertTrue(p.equivalent(MOCK_SAT6_SOURCE))
         self.assertTrue(p.equivalent(p))
         with self.assertRaises(TypeError):
             p.equivalent([])