~zulcss/horizon/horizon-g3-precise

« back to all changes in this revision

Viewing changes to horizon/test.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2012-06-01 10:57:56 UTC
  • mfrom: (1.1.15)
  • Revision ID: package-import@ubuntu.com-20120601105756-dif0km7n98vhdi2x
Tags: 2012.2~f2~20120530.1777-0ubuntu1
* New upstream release. 
* debian/patches/add_juju_settings_panel.patch: Refreshed
* debian/patches/turn-off-debug.patch: Refreshed

Show diffs side-by-side

added added

removed removed

Lines of Context:
52
52
 
53
53
def create_stubs(stubs_to_create={}):
54
54
    if not isinstance(stubs_to_create, dict):
55
 
        raise TypeError, ("create_stub must be passed a dict, but a %s was " \
56
 
                "given." % type(stubs_to_create).__name__)
 
55
        raise TypeError("create_stub must be passed a dict, but a %s was "
 
56
                        "given." % type(stubs_to_create).__name__)
57
57
 
58
58
    def inner_stub_out(fn):
59
59
        @wraps(fn)
60
60
        def instance_stub_out(self):
61
61
            for key in stubs_to_create:
62
 
                if not (isinstance(stubs_to_create[key], tuple) or \
 
62
                if not (isinstance(stubs_to_create[key], tuple) or
63
63
                        isinstance(stubs_to_create[key], list)):
64
 
                    raise TypeError, ("The values of the create_stub " \
65
 
                            "dict must be lists or tuples, but is a %s." %
66
 
                            type(stubs_to_create[key]).__name__)
 
64
                    raise TypeError("The values of the create_stub "
 
65
                                    "dict must be lists or tuples, but "
 
66
                                    "is a %s."
 
67
                                    % type(stubs_to_create[key]).__name__)
67
68
 
68
69
                for value in stubs_to_create[key]:
69
70
                    self.mox.StubOutWithMock(key, value)
206
207
                message_cookie = self.client.cookies['messages'].value
207
208
                messages = storage._decode(message_cookie)
208
209
        # Check for messages in the context
209
 
        elif hasattr(response, "context") and  "messages" in response.context:
 
210
        elif hasattr(response, "context") and "messages" in response.context:
210
211
            messages = response.context["messages"]
211
212
        # Check for messages attached to the request on a TemplateResponse
212
213
        elif hasattr(response, "_request") and hasattr(response._request,