This Page

Psst... hey. You're reading the latest content, but it might be out of sync with code. You can read Nova 2011.1 docs or all OpenStack docs too.

The nova.tests.test_api Module

Unit tests for the API endpoint

class nova.tests.test_api.ApiEc2TestCase(methodName='runTest')

Bases: nova.test.TestCase

Unit test for the cloud controller on an EC2 API

expect_http(host=None, is_secure=False, api_version=None)

Returns a new EC2 connection

setUp()
test_authorize_revoke_security_group_cidr()

Test that we can add and remove CIDR based rules to a security group

test_authorize_revoke_security_group_cidr_v6()

Test that we can add and remove CIDR based rules to a security group for IPv6

test_authorize_revoke_security_group_foreign_group()

Test that we can grant and revoke another security group access to a security group

test_create_delete_security_group()

Test that we can create a security group

test_describe_instances()

Test that, after creating a user and a project, the describe instances call to the API works properly

test_get_all_key_pairs()

Test that, after creating a user and project and generating a key pair, that the API call to list key pairs works properly

test_get_all_security_groups()

Test that we can retrieve security groups

test_return_valid_isoformat()

Ensure that the ec2 api returns datetime in xs:dateTime (which apparently isn’t datetime.isoformat()) NOTE(ken-pepple): https://bugs.launchpad.net/nova/+bug/721297

test_terminate_invalid_instance()

Attempt to terminate an invalid instance

test_xmlns_version_matches_request_version()
class nova.tests.test_api.FakeHttplibConnection(app, host, is_secure=False)

Bases: object

A fake httplib.HTTPConnection for boto to use

requests made via this connection actually get translated and routed into our WSGI app, we then wait for the response and turn it back into the httplib.HTTPResponse that boto expects.

close()

Required for compatibility with boto/tornado

getresponse()
getresponsebody()
request(method, path, data, headers)
class nova.tests.test_api.FakeHttplibSocket(response_string)

Bases: object

a fake socket implementation for httplib.HTTPResponse, trivial

makefile(_mode, _other)

Returns the socket’s internal buffer

class nova.tests.test_api.XmlConversionTestCase(methodName='runTest')

Bases: nova.test.TestCase

Unit test api xml conversion

test_number_conversion()