~vishvananda/nova/lp827024

« back to all changes in this revision

Viewing changes to nova/tests/api/openstack/fakes.py

  • Committer: Tarmac
  • Author(s): Chris Behrens
  • Date: 2011-08-09 21:09:10 UTC
  • mfrom: (1250.2.55 servers-search)
  • Revision ID: tarmac-20110809210910-ihhdtu9u7hjfos6i
This adds the servers search capabilities defined in the OS API v1.1 spec.. and more for admins.

For users, flavor=, image=, status=, and name= can be specified.  name= supports regular expression matching.
Most other options are ignored.  (things outside of the spec like 'recurse_zones' and 'reservation_id' still work, also)

If admin_api is enabled and context is an admin: along with the above, one can specify ip= and ip6= which will do regular expression matching.  Also, any other 'Instance' column name can be specified, so you can do regexp matching there as well.  Unknown Instance columns are ignored.

Also fixes up fixed_ip=, making a 404 returned vs a 500 error... and handling this properly with zone recursion as well.

Show diffs side-by-side

added added

removed removed

Lines of Context:
71
71
    return self.application
72
72
 
73
73
 
74
 
def wsgi_app(inner_app10=None, inner_app11=None, fake_auth=True):
 
74
def wsgi_app(inner_app10=None, inner_app11=None, fake_auth=True,
 
75
        fake_auth_context=None):
75
76
    if not inner_app10:
76
77
        inner_app10 = openstack.APIRouterV10()
77
78
    if not inner_app11:
78
79
        inner_app11 = openstack.APIRouterV11()
79
80
 
80
81
    if fake_auth:
81
 
        ctxt = context.RequestContext('fake', 'fake')
 
82
        if fake_auth_context is not None:
 
83
            ctxt = fake_auth_context
 
84
        else:
 
85
            ctxt = context.RequestContext('fake', 'fake')
82
86
        api10 = openstack.FaultWrapper(wsgi.InjectContext(ctxt,
83
87
              limits.RateLimitingMiddleware(inner_app10)))
84
88
        api11 = openstack.FaultWrapper(wsgi.InjectContext(ctxt,