Ask Your Question
1

Run unit test of java program using OpenstackAPI

asked 2014-12-01 06:01:16 -0500

rok gravatar image

Hi, I developed a restful webservice that uses Openstack nova APIs. I'm trying to use SOAPUI to do unit testing, but I'm encountering a problem. My method impements an Openstack Compute API when I do tests they returns "authentication required", because of course a token must be provided, the problem is that I cannot copy and paste it into the header, so in the meanwhile I type it (taking it from testing the authentication, wich works properly), it expires... Any suggestion? Thank you

edit retag flag offensive close merge delete

3 answers

Sort by ยป oldest newest most voted
1

answered 2014-12-03 02:46:37 -0500

rok gravatar image

Ok.. It was my mistake! I was sending a wrong header field "auth-header" ... actually is "X-Auth-Token"! Sorry.. now it works properly with GET methods, but I still have problems... every other method PUT/POST/DELETE I try, I get an error 500 from SoapUI, but this methods are working properly if I test them with a testing java class with a main() . Any suggestion?

edit flag offensive delete link more
1

answered 2014-12-02 13:21:21 -0500

updated 2014-12-03 16:52:45 -0500

In soap ui, you can have many steps for a test case, Basically you need to have multi step tests

Step1 : Get token by calling Identity api
Step2:  Call compute API. Here you can set the http header to the value from step 1
Step3:  Revoke token
edit flag offensive delete link more
1

answered 2014-12-02 12:50:35 -0500

mpetason gravatar image

If you are just testing then you could use the Admin Token until you build in logic to save the token and use it instead of typing it.

You can find the admin token in the keystone.conf file.

grep -i "admin_token" /etc/keystone/keystone.conf
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2014-12-01 06:01:16 -0500

Seen: 228 times

Last updated: Dec 03 '14