~ubuntu-branches/ubuntu/saucy/heat/saucy-updates

« back to all changes in this revision

Viewing changes to heat/tests/test_api_cloudwatch.py

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2013-08-08 15:23:59 UTC
  • mto: This revision was merged to the branch mainline in revision 12.
  • Revision ID: package-import@ubuntu.com-20130808152359-187gmaw0nx1oduxy
Tags: upstream-2013.2~b2.a186.g2b4b248
ImportĀ upstreamĀ versionĀ 2013.2~b2.a186.g2b4b248

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
from oslo.config import cfg
18
18
 
19
 
from heat.common import context
20
19
from heat.common import policy
21
20
from heat.openstack.common import rpc
22
21
from heat.common.wsgi import Request
24
23
import heat.api.cloudwatch.watch as watches
25
24
from heat.rpc import api as engine_api
26
25
from heat.tests.common import HeatTestCase
 
26
from heat.tests.utils import dummy_context
27
27
 
28
28
 
29
29
class WatchControllerTest(HeatTestCase):
31
31
    Tests the API class which acts as the WSGI controller,
32
32
    the endpoint processing API requests after they are routed
33
33
    '''
34
 
    # Utility functions
35
 
    def _create_context(self, user='api_test_user'):
36
 
        ctx = context.get_admin_context()
37
 
        self.m.StubOutWithMock(ctx, 'username')
38
 
        ctx.username = user
39
 
        return ctx
40
34
 
41
35
    def _dummy_GET_request(self, params={}):
42
36
        # Mangle the params dict into a query string
43
37
        qs = "&".join(["=".join([k, str(params[k])]) for k in params])
44
38
        environ = {'REQUEST_METHOD': 'GET', 'QUERY_STRING': qs}
45
39
        req = Request(environ)
46
 
        req.context = self._create_context()
 
40
        req.context = dummy_context()
47
41
        return req
48
42
 
49
43
    # The tests