Debian Codegraph @

keystoneclient/tests/unit/v2_0/client_fixtures.py

raw symbols SCIP
1 # Licensed under the Apache License, Version 2.0 (the "License"); you may
2 # not use this file except in compliance with the License. You may obtain
3 # a copy of the License at
4 #
5 # http://www.apache.org/licenses/LICENSE-2.0
6 #
7 # Unless required by applicable law or agreed to in writing, software
8 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10 # License for the specific language governing permissions and limitations
11 # under the License.
12 import uuid
13
14 from keystoneauth1 import fixture
15
16
17 def unscoped_token():
18 return fixture.V2Token(token_id='3e2813b7ba0b4006840c3825860b86ed',
19 expires='2012-10-03T16:58:01Z',
20 user_id='c4da488862bd435c9e6c0275a0d0e49a',
21 user_name='exampleuser')
22
23
24 def project_scoped_token():
25 _TENANT_ID = '225da22d3ce34b15877ea70b2a575f58'
26
27 f = fixture.V2Token(token_id='04c7d5ffaeef485f9dc69c06db285bdb',
28 expires='2012-10-03T16:53:36Z',
29 tenant_id='225da22d3ce34b15877ea70b2a575f58',
30 tenant_name='exampleproject',
31 user_id='c4da488862bd435c9e6c0275a0d0e49a',
32 user_name='exampleuser',
33 audit_chain_id=uuid.uuid4().hex)
34
35 f.add_role(id='member_id', name='Member')
36
37 s = f.add_service('volume', 'Volume Service')
38 s.add_endpoint(public='http://public.com:8776/v1/%s' % _TENANT_ID,
39 admin='http://admin:8776/v1/%s' % _TENANT_ID,
40 internal='http://internal:8776/v1/%s' % _TENANT_ID,
41 region='RegionOne')
42
43 s = f.add_service('image', 'Image Service')
44 s.add_endpoint(public='http://public.com:9292/v1',
45 admin='http://admin:9292/v1',
46 internal='http://internal:9292/v1',
47 region='RegionOne')
48
49 s = f.add_service('compute', 'Compute Service')
50 s.add_endpoint(public='http://public.com:8774/v2/%s' % _TENANT_ID,
51 admin='http://admin:8774/v2/%s' % _TENANT_ID,
52 internal='http://internal:8774/v2/%s' % _TENANT_ID,
53 region='RegionOne')
54
55 s = f.add_service('ec2', 'EC2 Service')
56 s.add_endpoint(public='http://public.com:8773/services/Cloud',
57 admin='http://admin:8773/services/Admin',
58 internal='http://internal:8773/services/Cloud',
59 region='RegionOne')
60
61 s = f.add_service('identity', 'Identity Service')
62 s.add_endpoint(public='http://public.com:5000/v2.0',
63 admin='http://admin:35357/v2.0',
64 internal='http://internal:5000/v2.0',
65 region='RegionOne')
66
67 return f
68
69
70 def auth_response_body():
71 f = fixture.V2Token(token_id='ab48a9efdfedb23ty3494',
72 expires='2010-11-01T03:32:15-05:00',
73 tenant_id='345',
74 tenant_name='My Project',
75 user_id='123',
76 user_name='jqsmith',
77 audit_chain_id=uuid.uuid4().hex)
78
79 f.add_role(id='234', name='compute:admin')
80 role = f.add_role(id='235', name='object-store:admin')
81 role['tenantId'] = '1'
82
83 s = f.add_service('compute', 'Cloud Servers')
84 endpoint = s.add_endpoint(public='https://compute.north.host/v1/1234',
85 internal='https://compute.north.host/v1/1234',
86 region='North')
87 endpoint['tenantId'] = '1'
88 endpoint['versionId'] = '1.0'
89 endpoint['versionInfo'] = 'https://compute.north.host/v1.0/'
90 endpoint['versionList'] = 'https://compute.north.host/'
91
92 endpoint = s.add_endpoint(public='https://compute.north.host/v1.1/3456',
93 internal='https://compute.north.host/v1.1/3456',
94 region='North')
95 endpoint['tenantId'] = '2'
96 endpoint['versionId'] = '1.1'
97 endpoint['versionInfo'] = 'https://compute.north.host/v1.1/'
98 endpoint['versionList'] = 'https://compute.north.host/'
99
100 s = f.add_service('object-store', 'Cloud Files')
101 endpoint = s.add_endpoint(public='https://swift.north.host/v1/blah',
102 internal='https://swift.north.host/v1/blah',
103 region='South')
104 endpoint['tenantId'] = '11'
105 endpoint['versionId'] = '1.0'
106 endpoint['versionInfo'] = 'uri'
107 endpoint['versionList'] = 'uri'
108
109 endpoint = s.add_endpoint(public='https://swift.north.host/v1.1/blah',
110 internal='https://compute.north.host/v1.1/blah',
111 region='South')
112 endpoint['tenantId'] = '2'
113 endpoint['versionId'] = '1.1'
114 endpoint['versionInfo'] = 'https://swift.north.host/v1.1/'
115 endpoint['versionList'] = 'https://swift.north.host/'
116
117 s = f.add_service('image', 'Image Servers')
118 s.add_endpoint(public='https://image.north.host/v1/',
119 internal='https://image-internal.north.host/v1/',
120 region='North')
121 s.add_endpoint(public='https://image.south.host/v1/',
122 internal='https://image-internal.south.host/v1/',
123 region='South')
124
125 return f