Skip to content

Commit 9137cc3

Browse files
author
Dean Troyer
committed
Do lookups for user, project in volume create
This required https://review.openstack.org/26323 in keystoneclient, merged long ago... Also adds some tests for 'volume create' Change-Id: I55bededbc20b5dcf2833c59eb2b6b069703d8a9a
1 parent 1fa1330 commit 9137cc3

6 files changed

Lines changed: 383 additions & 59 deletions

File tree

openstackclient/tests/volume/test_volume.py

Lines changed: 0 additions & 51 deletions
This file was deleted.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Copyright 2013 OpenStack Foundation
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License"); you may
4+
# not use this file except in compliance with the License. You may obtain
5+
# a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12+
# License for the specific language governing permissions and limitations
13+
# under the License.
14+
#
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Copyright 2013 Nebula Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License"); you may
4+
# not use this file except in compliance with the License. You may obtain
5+
# a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12+
# License for the specific language governing permissions and limitations
13+
# under the License.
14+
#
15+
16+
import mock
17+
18+
from openstackclient.tests import fakes
19+
20+
volume_id = 'vvvvvvvv-vvvv-vvvv-vvvvvvvv'
21+
volume_name = 'nigel'
22+
volume_description = 'Nigel Tufnel'
23+
volume_size = 120
24+
volume_metadata = {}
25+
26+
VOLUME = {
27+
'id': volume_id,
28+
'display_name': volume_name,
29+
'display_description': volume_description,
30+
'size': volume_size,
31+
'status': '',
32+
'attach_status': 'detatched',
33+
'metadata': volume_metadata,
34+
}
35+
36+
37+
class FakeVolumev1Client(object):
38+
def __init__(self, **kwargs):
39+
self.volumes = mock.Mock()
40+
self.volumes.resource_class = fakes.FakeResource(None, {})
41+
self.services = mock.Mock()
42+
self.services.resource_class = fakes.FakeResource(None, {})
43+
self.auth_token = kwargs['token']
44+
self.management_url = kwargs['endpoint']
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Copyright 2013 OpenStack, LLC.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License"); you may
4+
# not use this file except in compliance with the License. You may obtain
5+
# a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12+
# License for the specific language governing permissions and limitations
13+
# under the License.
14+
#
15+
16+
from openstackclient.tests.identity.v2_0 import fakes as identity_fakes
17+
from openstackclient.tests import utils
18+
from openstackclient.tests.volume.v1 import fakes
19+
20+
21+
AUTH_TOKEN = "foobar"
22+
AUTH_URL = "http://0.0.0.0"
23+
24+
25+
class TestVolumev1(utils.TestCommand):
26+
def setUp(self):
27+
super(TestVolumev1, self).setUp()
28+
29+
self.app.client_manager.volume = fakes.FakeVolumev1Client(
30+
endpoint=AUTH_URL,
31+
token=AUTH_TOKEN,
32+
)
33+
34+
self.app.client_manager.identity = identity_fakes.FakeIdentityv2Client(
35+
endpoint=AUTH_URL,
36+
token=AUTH_TOKEN,
37+
)

0 commit comments

Comments
 (0)