コード例 #1
0
    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
コード例 #2
0
    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
コード例 #3
0
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)
コード例 #4
0
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)