~ubuntu-branches/debian/sid/keystone/sid

« back to all changes in this revision

Viewing changes to tests/test_backend_templated.py

  • Committer: Package Import Robot
  • Author(s): Thomas Goirand
  • Date: 2013-05-10 10:22:18 UTC
  • mfrom: (1.2.1) (26.1.4 experimental)
  • Revision ID: package-import@ubuntu.com-20130510102218-7hph1420gz5jsyr7
Tags: 2013.1.1-2
* Uploading to unstable.
* New upstream release:
  - Fixes CVE-2013-2059: Keystone tokens not immediately invalidated when
  user is deleted [OSSA 2013-011] (Closes: #707598).
* Also installs httpd/keystone.py.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
import os
18
18
 
 
19
from keystone import catalog
 
20
from keystone.catalog.backends import templated as catalog_templated
 
21
from keystone import exception
19
22
from keystone import test
20
 
from keystone.catalog.backends import templated as catalog_templated
21
23
 
 
24
import default_fixtures
22
25
import test_backend
23
 
import default_fixtures
24
26
 
25
27
DEFAULT_CATALOG_TEMPLATES = os.path.abspath(os.path.join(
26
 
                                os.path.dirname(__file__),
27
 
                                    'default_catalog.templates'))
 
28
    os.path.dirname(__file__),
 
29
    'default_catalog.templates'))
28
30
 
29
31
 
30
32
class TestTemplatedCatalog(test.TestCase, test_backend.CatalogTests):
35
37
                'adminURL': 'http://localhost:8774/v1.1/bar',
36
38
                'publicURL': 'http://localhost:8774/v1.1/bar',
37
39
                'internalURL': 'http://localhost:8774/v1.1/bar',
38
 
                'name': "'Compute Service'"
 
40
                'name': "'Compute Service'",
 
41
                'id': '2'
39
42
            },
40
43
            'identity': {
41
44
                'adminURL': 'http://localhost:35357/v2.0',
42
45
                'publicURL': 'http://localhost:5000/v2.0',
43
46
                'internalURL': 'http://localhost:35357/v2.0',
44
 
                'name': "'Identity Service'"
 
47
                'name': "'Identity Service'",
 
48
                'id': '1'
45
49
            }
46
50
        }
47
51
    }
50
54
        super(TestTemplatedCatalog, self).setUp()
51
55
        self.opt_in_group('catalog', template_file=DEFAULT_CATALOG_TEMPLATES)
52
56
        self.catalog_api = catalog_templated.TemplatedCatalog()
 
57
        self.catalog_man = catalog.Manager()
53
58
        self.load_fixtures(default_fixtures)
54
59
 
55
60
    def test_get_catalog(self):
56
61
        catalog_ref = self.catalog_api.get_catalog('foo', 'bar')
57
 
        self.assertDictEquals(catalog_ref, self.DEFAULT_FIXTURE)
 
62
        self.assertDictEqual(catalog_ref, self.DEFAULT_FIXTURE)
 
63
 
 
64
    def test_malformed_catalog_throws_error(self):
 
65
        self.catalog_api.templates['RegionOne']['compute']['adminURL'] = \
 
66
            'http://localhost:$(compute_port)s/v1.1/$(tenant)s'
 
67
        with self.assertRaises(exception.MalformedEndpoint):
 
68
            self.catalog_api.get_catalog('fake-user', 'fake-tenant')