def test_creation_validation(self):
     # exist keyfile
     fake_ctx = self.generate_node_context(
         properties={'private_key_path': __file__})
     keypair.creation_validation(ctx=fake_ctx)
     # not exist keyfile
     fake_ctx = self.generate_node_context(
         properties={'private_key_path': __file__ + ".not_exist"})
     with self.assertRaises(cfy_exc.NonRecoverableError):
         keypair.creation_validation(ctx=fake_ctx)
コード例 #2
0
    def test_validation(self):
        self.ctx.node.properties.update(
            {'floatingip': self.test_config['floatingip']})
        with mock.patch('network_plugin.floatingip.ctx', self.ctx):
            floatingip.creation_validation()

        self.ctx.node.properties.update(
            {'floatingip': self.test_config['floatingip_auto']})
        with mock.patch('network_plugin.floatingip.ctx', self.ctx):
            floatingip.creation_validation()

        self.ctx.node.properties.update(
            {'private_key_path': os.path.realpath(__file__)})
        with mock.patch('network_plugin.keypair.ctx', self.ctx):
            keypair.creation_validation()

        self.ctx.node.properties.update({
            "resource_id":
            self.test_config['network']['name'],
            "network":
            self.test_config['network'],
            "use_external_resource":
            False
        })
        with mock.patch('network_plugin.network.ctx', self.ctx):
            network.creation_validation()

        self.ctx.node.properties.update({
            'port': {
                'network': self.test_config['management_network'],
                'ip_allocation_mode': 'dhcp',
                'primary_interface': True
            }
        })
        with mock.patch('network_plugin.port.ctx', self.ctx):
            port.creation_validation()

        self.ctx.node.properties.update({
            "nat":
            self.test_config['public_nat']['nat'],
            "rules":
            self.test_config['public_nat']['rules_net']
        })
        with mock.patch('network_plugin.public_nat.ctx', self.ctx):
            public_nat.creation_validation()

        self.ctx.node.properties.update(self.test_config['security_group'])
        with mock.patch('network_plugin.security_group.ctx', self.ctx):
            security_group.creation_validation()
 def test_creation_validation(self):
     # exist keyfile
     fake_ctx = self.generate_node_context(
         properties={
             'private_key_path': __file__
         }
     )
     keypair.creation_validation(ctx=fake_ctx)
     # not exist keyfile
     fake_ctx = self.generate_node_context(
         properties={
             'private_key_path': __file__ + ".not_exist"
         }
     )
     with self.assertRaises(cfy_exc.NonRecoverableError):
         keypair.creation_validation(ctx=fake_ctx)
コード例 #4
0
    def test_validation(self):
        self.ctx.node.properties.update(
            {'floatingip': self.test_config['floatingip']})
        with mock.patch('network_plugin.floatingip.ctx', self.ctx):
            floatingip.creation_validation()

        self.ctx.node.properties.update(
            {'floatingip': self.test_config['floatingip_auto']})
        with mock.patch('network_plugin.floatingip.ctx', self.ctx):
            floatingip.creation_validation()

        self.ctx.node.properties.update(
            {'private_key_path': os.path.realpath(__file__)})
        with mock.patch('network_plugin.keypair.ctx', self.ctx):
            keypair.creation_validation()

        self.ctx.node.properties.update(
            {"resource_id": self.test_config['network']['name'],
             "network": self.test_config['network'],
             "use_external_resource": False})
        with mock.patch('network_plugin.network.ctx', self.ctx):
            network.creation_validation()

        self.ctx.node.properties.update(
            {'port': {
                'network': self.test_config['management_network'],
                'ip_allocation_mode': 'dhcp',
                'primary_interface': True}})
        with mock.patch('network_plugin.port.ctx', self.ctx):
            port.creation_validation()

        self.ctx.node.properties.update(
            {"nat": self.test_config['public_nat']['nat'],
             "rules": self.test_config['public_nat']['rules_net']})
        with mock.patch('network_plugin.public_nat.ctx', self.ctx):
            public_nat.creation_validation()

        self.ctx.node.properties.update(self.test_config['security_group'])
        with mock.patch('network_plugin.security_group.ctx', self.ctx):
            security_group.creation_validation()