poppy/tests/api
Henry Yamauchi 1be3a21a61 Adds a security test to make sure paging links only use https
This test ensures that all paging links are over SSL and not
plain HTTP.

Change-Id: I1bf3dde26403ae2d12403b37e0b0c0946652b768
Implements: blueprint paging-links-over-https
2016-08-22 13:44:17 -04:00
..
admin Fix all calls to refactored services methods 2016-06-09 15:26:13 -04:00
assets fix: change default for `hard` querystring 2015-09-02 14:37:00 -04:00
flavors API test for list flavors 2015-08-05 15:55:13 -04:00
health Updates to API tests 2014-12-15 13:12:52 -05:00
services Adds a security test to make sure paging links only use https 2016-08-22 13:44:17 -04:00
ssl_certificate Add project_id field to ssl_cert GET response 2016-05-03 10:07:20 -04:00
utils Adds a security test to make sure paging links only use https 2016-08-22 13:44:17 -04:00
README.rst Updates to API tests README file. 2016-03-21 12:59:10 -04:00
__init__.py Add API Test Structure 2014-07-14 13:34:36 -04:00
base.py Fixes to get the tests passing 2016-05-19 10:33:01 -04:00
providers.py Add API tests for get service endpoint 2014-10-06 13:13:43 -04:00
requirements.txt Change repositories from stackforge to openstack 2015-10-26 14:58:43 -04:00

README.rst

API Tests

The API tests + test an actual API against a running environment. + are black box tests + can be used to test any running instance of poppy server (dev, test, prod, local instance, containerized instance)

To run the tests

  1. Create a new virtualenv and install the dependencies:

    NOTE: At the time of this writing opencafe is not compatible with python 3.
          So you will need to create virtualenv with python 2.
    
    $ pip install -r requirements/requirements.txt
    $ pip install -r tests/test-requirements.txt
    $ pip install -r tests/api/requirements.txt
    $ cafe-config init
    $ cafe-config plugins install http
  2. Set the following environment variables:

    export CAFE_CONFIG_FILE_PATH=~/.poppy/tests.conf
    export CAFE_ROOT_LOG_PATH=~/.poppy/logs
    export CAFE_TEST_LOG_PATH=~/.poppy/logs
  3. If you desire highlighting in the output, set the following environment variables:

    export NOSE_WITH_OPENSTACK=1
    export NOSE_OPENSTACK_COLOR=1
    export NOSE_OPENSTACK_RED=0.05
    export NOSE_OPENSTACK_YELLOW=0.025
    export NOSE_OPENSTACK_SHOW_ELAPSED=1
    export NOSE_OPENSTACK_STDOUT=1

a) If you intend to run the tests against a local poppy server, start server with the following command.

$ ./run_poppy.sh

b) If you intend to run the tests against a remote poppy server (say test or production env), grab the url. The url will be in the format http://remote.poppy-server.com/v1.0

  1. Make a directory ~/.poppy

    mkdir ~/.poppy

  2. Copy the api.conf file to the path set by CAFE_CONFIG_FILE_PATH:

    $ cp tests/etc/api.conf ~/.poppy/tests.conf
  3. Update the config file in ~/.poppy/tests.conf with the appropriate values

  4. Once you are ready to run the tests:

    $ nosetests api

Tox Support

You can run tox using a docker container hosting Cassandra:

Note - This will require docker (or boot2docker for MacOSX) to already be installed on the system.

  1. Update your ~/.poppy/tests.conf to point to your docker cassandra/zookeeper container ip address.

Example 1: Run all API tests against a docker hosted cassandra instance:

$ tox -e api

Example 2: Run a particular API test function:

$ tox -e api api/services/test_services.py:TestCreateService -- -m test_create_service_positive

Mimic Support

Occassionaly you want to test against a mock api rather than the real thing to get around rate limiting issues, and to get around having to create accounts with a certain provider.

Mimic helps accomplish this goal for testing.

  1. Run the mimic docker container (via ./run_poppy.sh) and point any remote api url in your test.conf file to your http://dockerhost:8900/mimic_service_name