def setUp(self): self.network_name = "test_net_name" self.driver = KubernetesNoPolicyDriver(self.network_name) assert_equal(self.driver.profile_name, self.network_name) # Mock the DatastoreClient self.client = MagicMock(spec=DatastoreClient) self.driver._client = self.client
class KubernetesDefaultPolicyDriverTest(unittest.TestCase): """ Test class for KubernetesDefaultPolicyDriver class. """ def setUp(self): self.network_name = "test_net_name" self.driver = KubernetesNoPolicyDriver(self.network_name) assert_equal(self.driver.profile_name, self.network_name) # Mock the DatastoreClient self.client = MagicMock(spec=DatastoreClient) self.driver._client = self.client def test_generate_rules(self): # Generate rules rules = self.driver.generate_rules() # Assert correct. expected = Rules(id=self.network_name, inbound_rules=[Rule(action="allow")], outbound_rules=[Rule(action="allow")]) assert_equal(rules, expected)