Esempio n. 1
0
    def test_create_subnet(self):

        fake_network = self.fake_object['network']

        self.useFixture(
            mockpatch.PatchObject(javelin,
                                  "client_for_user",
                                  return_value=self.fake_client))
        self.useFixture(
            mockpatch.PatchObject(javelin,
                                  "_get_resource_by_name",
                                  return_value=fake_network))

        fake_netaddr = mock.MagicMock()
        self.useFixture(
            mockpatch.PatchObject(javelin,
                                  "netaddr",
                                  return_value=fake_netaddr))
        fake_version = javelin.netaddr.IPNetwork().version

        javelin.create_subnets([self.fake_object])

        mocked_function = self.fake_client.networks.create_subnet
        mocked_function.assert_called_once_with(network_id=fake_network['id'],
                                                cidr=self.fake_object['range'],
                                                name=self.fake_object['name'],
                                                ip_version=fake_version)
Esempio n. 2
0
    def test_create_subnet(self):

        fake_network = self.fake_object["network"]

        self.useFixture(mockpatch.PatchObject(javelin, "client_for_user", return_value=self.fake_client))
        self.useFixture(mockpatch.PatchObject(javelin, "_get_resource_by_name", return_value=fake_network))

        fake_netaddr = mock.MagicMock()
        self.useFixture(mockpatch.PatchObject(javelin, "netaddr", return_value=fake_netaddr))
        fake_version = javelin.netaddr.IPNetwork().version

        javelin.create_subnets([self.fake_object])

        mocked_function = self.fake_client.networks.create_subnet
        mocked_function.assert_called_once_with(
            network_id=fake_network["id"],
            cidr=self.fake_object["range"],
            name=self.fake_object["name"],
            ip_version=fake_version,
        )