Exemplo n.º 1
0
    def test_update(self):
        fakes.script_keystone_client()
        resp = fakes.FakeHTTPResponse(202,
            'Accepted',
            {},
            'The request is accepted for processing.')
        v1client.Client.json_request('PUT', '/stacks/teststack2/2',
                          body=mox.IgnoreArg()).AndReturn((resp, None))
        fakes.script_heat_list()

        self.m.ReplayAll()

        template_file = os.path.join(TEST_VAR_DIR, 'minimal.template')
        create_text = self.shell('update teststack2/2 '
            '--template-file=%s '
            '--parameters="InstanceType=m1.large;DBUsername=wp;'
            'DBPassword=verybadpassword;KeyName=heat_key;'
            'LinuxDistribution=F17"' % template_file)

        required = [
            'Name/ID',
            'teststack/1'
        ]
        for r in required:
            self.assertRegexpMatches(create_text, r)

        self.m.VerifyAll()
Exemplo n.º 2
0
    def test_create_url(self):

        fakes.script_keystone_client()
        resp = fakes.FakeHTTPResponse(201,
            'Created',
            {'location': 'http://no.where/v1/tenant_id/stacks/teststack2/2'},
            None)
        v1client.Client.json_request('POST', '/stacks',
                          body=mox.IgnoreArg()).AndReturn((resp, None))
        fakes.script_heat_list()

        self.m.ReplayAll()

        create_text = self.shell('create teststack '
            '--template-url=http://no.where/minimal.template '
            '--parameters="InstanceType=m1.large;DBUsername=wp;'
            'DBPassword=verybadpassword;KeyName=heat_key;'
            'LinuxDistribution=F17"')

        required = [
            'Name/ID',
            'teststack2/2'
        ]
        for r in required:
            self.assertRegexpMatches(create_text, r)

        self.m.VerifyAll()
Exemplo n.º 3
0
    def test_create_object(self):

        fakes.script_keystone_client()
        template_file = os.path.join(TEST_VAR_DIR, 'minimal.template')
        template_data = open(template_file).read()
        v1client.Client.raw_request('GET',
                          'http://no.where/container/minimal.template',
                          ).AndReturn(template_data)

        resp = fakes.FakeHTTPResponse(201,
            'Created',
            {'location': 'http://no.where/v1/tenant_id/stacks/teststack2/2'},
            None)
        v1client.Client.json_request('POST', '/stacks',
                          body=mox.IgnoreArg()).AndReturn((resp, None))

        fakes.script_heat_list()

        self.m.ReplayAll()

        create_text = self.shell('create teststack2 '
            '--template-object=http://no.where/container/minimal.template '
            '--parameters="InstanceType=m1.large;DBUsername=wp;'
            'DBPassword=verybadpassword;KeyName=heat_key;'
            'LinuxDistribution=F17"')

        required = [
            'Name/ID',
            'teststack2/2'
        ]
        for r in required:
            self.assertRegexpMatches(create_text, r)

        self.m.VerifyAll()
Exemplo n.º 4
0
    def test_list(self):
        fakes.script_keystone_client()
        fakes.script_heat_list()

        self.m.ReplayAll()

        list_text = self.shell('list')

        required = [
            'ID',
            'Status',
            'Created',
            'teststack/1',
            'CREATE_COMPLETE',
            'IN_PROGRESS',
        ]
        for r in required:
            self.assertRegexpMatches(list_text, r)

        self.m.VerifyAll()
Exemplo n.º 5
0
    def test_delete(self):
        fakes.script_keystone_client()
        resp = fakes.FakeHTTPResponse(204,
            'No Content',
            {},
            None)
        v1client.Client.raw_request('DELETE', '/stacks/teststack2/2',
                          ).AndReturn((resp, None))
        fakes.script_heat_list()

        self.m.ReplayAll()

        create_text = self.shell('delete teststack2/2')

        required = [
            'Name/ID',
            'teststack/1'
        ]
        for r in required:
            self.assertRegexpMatches(create_text, r)

        self.m.VerifyAll()