tests package

Submodules

tests.test_admin module

Test administrative requests

class tests.test_admin.TestAdmin(methodName='runTest')[source]

Bases: unittest.case.TestCase

run_admin_test(request_type)[source]

Actually do the work

test_admin_json()[source]

Creates a new account, authenticates as this account and deletes it afterwards. Assumes, that this works correctly (in json format)

test_admin_xml()[source]

Creates a new account, authenticates as this account and deletes it afterwards. Assumes, that this works correctly (in xml format)

tests.test_auth module

Test the auth tool

class tests.test_auth.TestAuth(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_admin_auth_json()[source]

Send a configured admin auth request in json format using the admin auth-method and check a successfully returned token

test_admin_auth_xml()[source]

Send a configured admin auth request in xml format using the admin auth-method and check a successfully returned token

test_auth_failure_json()[source]

Send a configured auth request with a wrong password in json format and check the result

test_auth_failure_raise()[source]

Send a configured auth request with a wrong password in json format and let it raise an exception

test_auth_failure_xml()[source]

Send a configured auth request with a wrong password in XML format and check the result

test_auth_json()[source]

Send a configured auth request in json format and check a successfully returned token

test_auth_xml()[source]

Send a configured auth request in XML format and check a successfully returned token

test_password_auth_failure_json()[source]

Send a configured auth request in json format using password based authentication and a wrong password and check the error

test_password_auth_failure_xml()[source]

Send a configured auth request in xml format using password based authentication and a wrong password and check the error

test_password_auth_json()[source]

Send a configured auth request in json format using password based authentication and check a successfully returned token

test_password_auth_xml()[source]

Send a configured auth request in xml format using password based authentication and check a successfully returned token

tests.test_autoresponse module

Test, wether send_request can create a request automatically on its own

class tests.test_autoresponse.TestAutoresponse(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_autoresponse_json()[source]

Create a JSON-request and pass this to send_request expection a json response.

test_autoresponse_xml()[source]

Create an XML-request and pass this to send_request expection a xml response.

tests.test_fault module

Fault tests

class tests.test_fault.TestRequestFault(methodName='runTest')[source]

Bases: unittest.case.TestCase

Fault tests

check_response(response)[source]
cleanUp()[source]

Clean up after one step to leave a dedicated result for the other test cases.

request = None

The request to be tested against

setUp()[source]
tearDown()[source]
test_fault_non_existing_folder_batch_json()[source]

Request a non existing folder multiple times to get multiple faults

test_fault_non_existing_folder_batch_xml()[source]

Request a non existing folder multiple times to get multiple faults

test_fault_non_existing_folder_genrequest()[source]

Request a non existing folder, so we get a fitting fault

test_fault_non_existing_folder_genrequest_invalidurl()[source]

Request a non existing folder, so we get a fitting fault

test_fault_non_existing_folder_genrequest_xml()[source]

Request a non existing folder, so we get a fitting fault

test_fault_non_existing_folder_json()[source]

Request a non existing folder, so we get a fitting fault

test_fault_non_existing_folder_xml()[source]

Request a non existing folder, so we get a fitting fault

tests.test_genrequest module

Test usage of communication.authenticate and communication.gen_request

class tests.test_genrequest.TestGenrequest(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_genrequest_batch()[source]

Create a batch-request only using the Communication-object

test_genrequest_batch_invalid()[source]

Create a batchrequest only using the Communication-object, send it and request an invalid request id

test_genrequest_batch_invalid_xml()[source]

Create a batchrequest only using the Communication-object, send it and request an invalid request id (xml)

test_genrequest_batch_xml()[source]

Create a batch-request only using the Communication-object ( xml-version)

test_genrequest_check_response()[source]

Create a request only using the Communication-object, send it and check the response

test_genrequest_check_response_batch()[source]

Create a batch-request only using the Communication-object

test_genrequest_check_response_batch_xml()[source]

Create a batch-request only using the Communication-object

test_genrequest_check_response_xml()[source]

Create a request only using the Communication-object, send it and check the response

test_genrequest_default()[source]

Create a request only using the Communication-object

test_genrequest_fail()[source]

Create a request only using the Communication-object

test_genrequest_xml()[source]

Create a request only using the Communication-object

tests.test_preauth module

Test Preauth tool

class tests.test_preauth.TestPreauth(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_create_preauth()[source]

Test creating a preauth

This is mostly bogus, as the return value cannot be tested against something senseful. It’s just tested if the method can be called and it returns a str.

tests.test_request_json module

Request tests

class tests.test_request_json.TestRequestJson(methodName='runTest')[source]

Bases: unittest.case.TestCase

Request tests

cleanUp()[source]

Clean up after one step to leave a dedicated result for the other test cases.

request = None

The request to be tested against

setUp()[source]
tearDown()[source]
test_add_request()[source]

Test adding a request

test_batch_add_request()[source]

Test adding multiple request to a batch request

test_empty_request()[source]

Create an empty request and check the created xml

test_enable_batch_default()[source]

Test enabling batch requests

test_enable_batch_stop()[source]

Test enabling batch requests with additional parameter

test_set_context_params()[source]

Add all currently accepted params and check the result

test_set_context_params_failtype()[source]

Add context parameters to the request and expect the method to send an exception

tests.test_request_xml module

Request tests

class tests.test_request_xml.TestRequestXml(methodName='runTest')[source]

Bases: unittest.case.TestCase

Request tests

cleanUp()[source]

Clean up after one step to leave a dedicated result for the other test cases.

request = None

The request to be tested against

setUp()[source]
tearDown()[source]
test_add_request()[source]

Test adding a request

test_batch_add_request()[source]

Test adding multiple request to a batch request

test_empty_request()[source]

Create an empty request and check the created xml

test_enable_batch_default()[source]

Test enabling batch requests

test_enable_batch_stop()[source]

Test enabling batch requests with additional parameter

test_set_context_params()[source]

Add all currently accepted params and check the result

test_set_context_params_failtype()[source]

Add context parameters to the request and expect the method to send an exception

tool_assert_equal_xml(xml_a, xml_b, message=None)[source]

tests.test_response_json module

Testing response class

class tests.test_response_json.TestResponseJson(methodName='runTest')[source]

Bases: unittest.case.TestCase

Response class tests

response = None

Our response object

setUp()[source]

Generate a Response object and set our tested server result string

test_get_batch()[source]
test_get_body()[source]

Checks the body against a pickled expectation

test_get_header()[source]
test_get_response()[source]
test_is_batch()[source]
tested_server_result = '{ "Header": { "context": { "_jsns": "urn:zimbra" } }, "Body": { "GetVersionInfoResponse": { "info": { "type": "NETWORK", "version": "8.0.5_GA_5839.NETWORK", "release": "20130910124124", "buildDate": "20130910-1244", "host": "zre-ubuntu12-64", "platform": "UBUNTU12_64", "majorversion": "8", "minorversion": "0", "microversion": "5" }, "_jsns": "urn:zimbraAdmin" } }, "_jsns": "urn:zimbraSoap" }'

The result we test against (coming from a GetVersionInfoRequest)

tests.test_response_xml module

Testing response class

class tests.test_response_xml.TestResponseXml(methodName='runTest')[source]

Bases: unittest.case.TestCase

Response class tests

response = None

Our response object

setUp()[source]

Generate a Response object and set our tested server result string

test_get_batch()[source]
test_get_body()[source]

Checks the body against a pickled expectation

test_get_header()[source]
test_get_response()[source]
test_get_response_multi()[source]

For cases where we have several tags with the same name.

In that case, for a given tag name as a key, we want a list of dicts containing the content of each tag, instead of a single dict.

test_is_batch()[source]
tested_server_result = '<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"><soap:Header><context xmlns="urn:zimbra"/></soap:Header><soap:Body><GetVersionInfoResponse xmlns="urn:zimbraAdmin"><info platform="UBUNTU12_64" host="zre-ubuntu12-64" minorversion="0" microversion="5" buildDate="20130910-1244" type="NETWORK" majorversion="8" release="20130910124124" version="8.0.5_GA_5839.NETWORK"/></GetVersionInfoResponse></soap:Body></soap:Envelope>'

The result we test against (coming from a GetVersionInfoRequest by running zmsoap -z –json -t admin GetVersionInfoRequest -vv)

tested_server_result_multi_value = '<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"><soap:Header><context xmlns="urn:zimbra"/></soap:Header><soap:Body><GetAllDomainsResponse> <domain id="b37d6b9" name="client1.unbound.example.fr"></domain><domain id="444d6b9" name="client1.unbound.example.fr"></domain></GetAllDomainsResponse></soap:Body></soap:Envelope>'

This one is a stripped version of a GetAlDomains

tests.test_xmlserializer module

Tests of XML Serializer tools

class tests.test_xmlserializer.TestXmlSerializer(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_dict_to_dom()[source]

Test xml serialization using dict_to_dom method.

test_dict_to_dom_unicode()[source]

Test xml serialization using dict_to_dom method.

test_dom_to_dict()[source]

Test xml->dict serialization

Creates a node, generates the dict using dict_to_dom and compares a pickled result

Module contents

Python-Zimbra test suite

tests.get_config()[source]