[Openstack] Unit Tests Problem

Vinod Kumar Boppanna vinod.kumar.boppanna at cern.ch
Sat Feb 22 01:25:44 UTC 2014


Hi,

I have written a code in nova and for that i have to write Unit Tests. I could do complete it and some of the functions in this Unit Test result in Success. One function is failing, because it is actually calling the code in Nova, in which it makes connection to keystone (using keystoneclient.v3.client) to get some data. For making this connection it uses the auth_token. But in the unit test, i am creating a fake context and so i guess there is no auth_token. Due to this, a URL testing is failing.

For eg: In the Unit Test, i am calling

req = fakes.HTTPRequestV3.blank('/v2/fake4/.........',
                                      use_admin_context=True)
res_dict = self.controller.update(req, 'update_me', body)

Now, in the nova code for this URL, i am using

keystone = keystoneclient.v3.Client(token=context.auth_token,
                                 auth_url=auth_url,
                                 project_id=context.project_id)

So, here the SSL authorization failed error coming up for the test.

How can i solve this? How can i create a auth_token in the unit test and pass somehow to the actual nova, which it can use it in the keystoneclient api call to make the call successfully?

Thanks & Regards,
Vinod Kumar Boppanna

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack/attachments/20140222/69c8130d/attachment.html>


More information about the Openstack mailing list