~ubuntu-branches/ubuntu/trusty/python-keystoneclient/trusty-proposed

« back to all changes in this revision

Viewing changes to tests/v2_0/test_endpoints.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2012-03-26 14:01:05 UTC
  • mfrom: (1.1.7)
  • Revision ID: package-import@ubuntu.com-20120326140105-c9ddds5lbchco3ia
Tags: 2012.1~rc1-0ubuntu1
New upstream release. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
class EndpointTests(utils.TestCase):
11
11
    def setUp(self):
12
12
        super(EndpointTests, self).setUp()
13
 
        self.TEST_REQUEST_HEADERS = {'X-Auth-Token': 'aToken',
14
 
                                     'User-Agent': 'python-keystoneclient'}
15
 
        self.TEST_POST_HEADERS = {'Content-Type': 'application/json',
16
 
                                  'X-Auth-Token': 'aToken',
17
 
                                  'User-Agent': 'python-keystoneclient'}
18
 
        self.TEST_ENDPOINTS = {'endpoints': [
19
 
                                {
20
 
                                  'adminurl':
21
 
                                    'http://host-1:8774/v1.1/$(tenant_id)s',
22
 
                                  'id':
23
 
                                    '8f9531231e044e218824b0e58688d262',
24
 
                                  'internalurl':
25
 
                                    'http://host-1:8774/v1.1/$(tenant_id)s',
26
 
                                  'publicurl':
27
 
                                    'http://host-1:8774/v1.1/$(tenant_id)s',
28
 
                                  'region':
29
 
                                    'RegionOne'
30
 
                                },
31
 
                                {
32
 
                                  'adminurl':
33
 
                                    'http://host-1:8774/v1.1/$(tenant_id)s',
34
 
                                  'id':
35
 
                                    '8f9531231e044e218824b0e58688d263',
36
 
                                  'internalurl':
37
 
                                    'http://host-1:8774/v1.1/$(tenant_id)s',
38
 
                                  'publicurl':
39
 
                                    'http://host-1:8774/v1.1/$(tenant_id)s',
40
 
                                  'region':
41
 
                                    'RegionOne'
42
 
                                }
43
 
                              ]
44
 
                            }
 
13
        self.TEST_REQUEST_HEADERS = {
 
14
            'X-Auth-Token': 'aToken',
 
15
            'User-Agent': 'python-keystoneclient',
 
16
            }
 
17
        self.TEST_POST_HEADERS = {
 
18
            'Content-Type': 'application/json',
 
19
            'X-Auth-Token': 'aToken',
 
20
            'User-Agent': 'python-keystoneclient',
 
21
            }
 
22
        self.TEST_ENDPOINTS = {
 
23
            'endpoints': [
 
24
                {
 
25
                    'adminurl': 'http://host-1:8774/v1.1/$(tenant_id)s',
 
26
                    'id': '8f9531231e044e218824b0e58688d262',
 
27
                    'internalurl': 'http://host-1:8774/v1.1/$(tenant_id)s',
 
28
                    'publicurl': 'http://host-1:8774/v1.1/$(tenant_id)s',
 
29
                    'region': 'RegionOne',
 
30
                    },
 
31
                {
 
32
                    'adminurl': 'http://host-1:8774/v1.1/$(tenant_id)s',
 
33
                    'id': '8f9531231e044e218824b0e58688d263',
 
34
                    'internalurl': 'http://host-1:8774/v1.1/$(tenant_id)s',
 
35
                    'publicurl': 'http://host-1:8774/v1.1/$(tenant_id)s',
 
36
                    'region': 'RegionOne',
 
37
                    }
 
38
                ]
 
39
            }
45
40
 
46
41
    def test_create(self):
47
 
        req_body = {"endpoint": {"region": "RegionOne",
48
 
                                 "publicurl":
49
 
                                     "http://host-3:8774/v1.1/$(tenant_id)s",
50
 
                                 "internalurl":
51
 
                                     "http://host-3:8774/v1.1/$(tenant_id)s",
52
 
                                 "adminurl":
53
 
                                     "http://host-3:8774/v1.1/$(tenant_id)s",
54
 
                                 "service_id": "e044e21"}}
 
42
        req_body = {
 
43
            "endpoint": {
 
44
                "region": "RegionOne",
 
45
                "publicurl": "http://host-3:8774/v1.1/$(tenant_id)s",
 
46
                "internalurl": "http://host-3:8774/v1.1/$(tenant_id)s",
 
47
                "adminurl": "http://host-3:8774/v1.1/$(tenant_id)s",
 
48
                "service_id": "e044e21",
 
49
                }
 
50
            }
55
51
 
56
 
        resp_body = {"endpoint": {
57
 
                        "adminurl":
58
 
                        "http://host-3:8774/v1.1/$(tenant_id)s",
59
 
                        "region": "RegionOne",
60
 
                        "id": "1fd485b2ffd54f409a5ecd42cba11401",
61
 
                        "internalurl":
62
 
                        "http://host-3:8774/v1.1/$(tenant_id)s",
63
 
                        "publicurl":
64
 
                        "http://host-3:8774/v1.1/$(tenant_id)s"}}
 
52
        resp_body = {
 
53
            "endpoint": {
 
54
                "adminurl": "http://host-3:8774/v1.1/$(tenant_id)s",
 
55
                "region": "RegionOne",
 
56
                "id": "1fd485b2ffd54f409a5ecd42cba11401",
 
57
                "internalurl": "http://host-3:8774/v1.1/$(tenant_id)s",
 
58
                "publicurl": "http://host-3:8774/v1.1/$(tenant_id)s",
 
59
                }
 
60
            }
65
61
 
66
62
        resp = httplib2.Response({
67
63
            "status": 200,
88
84
    def test_delete(self):
89
85
        resp = httplib2.Response({
90
86
            "status": 200,
91
 
            "body": ""
 
87
            "body": "",
92
88
            })
93
89
        httplib2.Http.request(urlparse.urljoin(self.TEST_URL,
94
90
                              'v2.0/endpoints/8f953'),
113
109
        self.mox.ReplayAll()
114
110
 
115
111
        endpoint_list = self.client.endpoints.list()
116
 
        [self.assertTrue(isinstance(r, endpoints.Endpoint)) \
117
 
                for r in endpoint_list]
 
112
        [self.assertTrue(isinstance(r, endpoints.Endpoint))
 
113
         for r in endpoint_list]