mcvirt.test package

Submodules

mcvirt.test.auth_tests module

class mcvirt.test.auth_tests.AuthTests(methodName='runTest')[source]

Bases: mcvirt.test.test_base.TestBase

Provides unit tests for the Auth class

TEST_PASSWORD = 'test-password'
TEST_USERNAME = 'test-user'
TEST_USERNAME_ALTERNATIVE = 'user-to-delete'
create_test_user(username, password)[source]

Create a test user, annotate the user object and return it

parse_command(command, username, password)[source]

Parse the specified command with the specified credentials

setUp()[source]

Set up a test user

static suite()[source]

Returns a test suite of the Auth tests

tearDown()[source]

Remove the test user

test_add_delete_superuser()[source]

Add/delete a user to/from the superuser role

test_add_duplicate_superuser()[source]

Attempts to add a superuser twice

test_add_new_user()[source]

Create a new user through the parser

test_add_remove_user_permission()[source]

Add a user to a virtual machine, using the argument parser

test_attempt_add_superuser_to_vm()[source]

Attempts to add a user as a superuser to a VM

test_change_password()[source]

Change the password of a user through the parser

test_delete_non_existant_superuser()[source]

Attempts to remove a non-existent user from the superuser group

test_remove_user_account()[source]

Delete a user through the parser

mcvirt.test.run_tests module

mcvirt.test.test_base module

class mcvirt.test.test_base.TestBase(methodName='runTest')[source]

Bases: unittest.case.TestCase

Provide base test case, with constructor/destructor for providing access to the parser and RPC

RPC_PASSWORD = 'pass'
RPC_USERNAME = 'mjc'
create_vm(vm_name, storage_type)[source]

Create a test VM, annotate object and ensure it exists

setUp()[source]

Obtain connections to the daemon and create various member variables.

stop_and_delete(vm_name)[source]

Stop and remove a virtual machine

tearDown()[source]

Destroy stored objects.

mcvirt.test.test_base.skip_drbd(required)[source]

mcvirt.test.unit_test_bootstrap module

class mcvirt.test.unit_test_bootstrap.UnitTestBootstrap[source]

Bases: object

Bootstrap daemon with unit tests

daemon_loop_condition()[source]

Provide a condition for the daemon loop

start()[source]

Start the daemon, run the unit tests and tear down

mcvirt.test.update_tests module

class mcvirt.test.update_tests.UpdateTests(methodName='runTest')[source]

Bases: mcvirt.test.test_base.TestBase

Provide unit tests for the functionality provided by the update subparser

setUp()[source]

Create network adapter factory

static suite()[source]

Return a test suite

tearDown()[source]

Tear down network adapter factory

test_remove_network()[source]

Remove a network interface from a VM, using the parser

test_remove_network_non_existant()[source]

Attempt to remove a network interface from a VM that doesn’t exist

mcvirt.test.validation_tests module

class mcvirt.test.validation_tests.ValidationTests(methodName='runTest')[source]

Bases: mcvirt.test.test_base.TestBase

Provides unit tests for validation

static suite()[source]

Return a test suite of validation tests

test_boolean()[source]

Test the validation of booleans

test_create_network()[source]

Test creating a netork with an invalid name to check that network creation uses ArgumentValidator

test_create_vm()[source]

Test an invalid VM name to check that VM creation uses ArgumentValidator

test_drbd_resource()[source]
test_hostnames()[source]

Test the validation of hostnames

test_integer()[source]

Test the validation of integers

test_network_names()[source]

Test the validation of network names

test_pos_integer()[source]

Test the validation of positive integers

test_validity(validator, valid_list, invalid_list, expected_exception=<type 'exceptions.TypeError'>)[source]

Use the provided validator function to test each string in valid_list and invalid_list, failing the test if expected_exception is raised for anything in valid_list, and failing if the exception is NOT raised for anything in invalid_list

Module contents