API

Version 0.4.5.dev0

Data management and setup

aquarium.entity_util.add_group_permissions(group_id, permissions)[source]
aquarium.entity_util.create_client(self, internal_headers, client=None, room_id=None, scopes=None)[source]
aquarium.entity_util.create_global_notification_token(self, admin)[source]
aquarium.entity_util.create_group(self, group=None, admin=None, initial_room_name=None)[source]
aquarium.entity_util.create_personal_token(self, user)[source]
aquarium.entity_util.create_personal_token_headers(self, user)[source]
aquarium.entity_util.create_room(self, session_headers, room=None, created=None, privacy='public', owner_user_id=None)[source]
aquarium.entity_util.create_room_token(self, admin, room)[source]
aquarium.entity_util.create_session_headers(access_token)[source]
aquarium.entity_util.create_token(self, client, admin_id=None, admin_pw=None, session=None)[source]
aquarium.entity_util.create_user(self, group_id=None, user=None, session=None, created=None)[source]
aquarium.entity_util.create_user_and_return_response(username='user-1446855945237', full_name=None, email=None, group_id=None, session=None)[source]
The method invokes create user api and returns response as is
Parameters:
  • username – User name
  • full_name – User’s full name
  • email – User email
  • group_id – User group id
  • session – Authentication session
Returns:

Response content

aquarium.entity_util.create_webhook(self, addon, session_headers, room, reg_data, validator_func=<function <lambda> at 0x2b73f50>, response_handler=None, path='/webhook')[source]

Create webhook for specified addon and room

This unbound method increments self.webhook_called attribute. Note that this attribute should be set to a numeric value (i.e. self.webhook_called = 0) beforehand.

It also sets self.webhook_id to the id of the created webhook.

aquarium.entity_util.delete_client(self, internal_headers, client)[source]
aquarium.entity_util.delete_group(self, internal_headers, group_id)[source]
aquarium.entity_util.delete_room(self, internal_headers, room)[source]
aquarium.entity_util.delete_user(self, internal_headers, user)[source]
aquarium.entity_util.get_room(self, group_id, room_identifier)[source]

This method takes in a user identifier and returns the user object in the form of a dictionary :param group_id: User group Id :param room_identifier: Room identifier this can be an id, or room name :return: Json response from the api call, information on room or an error response

aquarium.entity_util.get_user(self, group_id, user_identifier)[source]

This method takes in a user identifier and returns the user object in the form of a dictionary :param group_id: User group Id :param user_identifier: User identifier this can be an email, id, or mention name :return: Json response from the api call, information on user or an error response

aquarium.entity_util.internalize_url(public_url)[source]
aquarium.entity_util.make_internal_headers(group_id, user_id=None)[source]
aquarium.entity_util.prefix_es(prefix='test')[source]
aquarium.entity_util.refresh_search_index(internal_headers)[source]
aquarium.entity_util.rnd()[source]
aquarium.entity_util.rnd_str(size, all_upper=False, contain_digits=False)[source]
aquarium.entity_util.token_url()[source]
aquarium.entity_util.with_client(client=None, group=None, admin=None, initial_room_name=None, product=None, scopes=None)[source]
aquarium.entity_util.with_public_client(client=None, group=None, admin=None, initial_room_name=None, product=None)[source]
aquarium.entity_util.with_room(room=None, created=None, privacy='public')[source]
aquarium.entity_util.with_token(session=None)[source]
aquarium.entity_util.with_user(kw='user', user=None, created=None)[source]
class aquarium.request_util.RequestsTestCase(methodName='runTest')[source]
assertHeaders(expected, resp)[source]
assertStatusCode(expected, resp, match=None)[source]
aquarium.request_util.as_timestamp(value)[source]
aquarium.request_util.assertHeaders(self, expected, resp)[source]
aquarium.request_util.assertStatusCode(self, expected, resp, match=None)[source]
aquarium.request_util.consume_all(url, headers)[source]

Requests a paged resource and keeps requesting until there are no more items

aquarium.request_util.find_deleted(url, target_id, headers)[source]

Add-on simulation

class aquarium.server_util.AddonServer(host='ip-172-30-219-27', use_ssl=False, port=None, cert_file='self_signed.crt', key_file='self_signed.key')[source]
capabilities(test, internal_headers, doc)[source]
get(path, func)[source]

Registers a handler function to be called when a GET request beginning with ‘path’ is made.

Parameters:
  • path – The path prefix to listen on
  • func – The function to call. Should be a function that takes the querystring as a parameter.
post(path, func)[source]

Registers a handler function to be called when a POST request beginning with ‘path’ is made.

Parameters:
  • path – The path prefix to listen on
  • func – The function to call. Should be a function that takes the post body as a parameter.
shutdown()[source]
class aquarium.server_util.AddonTestCase(methodName='runTest')[source]
install_addon_and_get_token(addon_url, headers, addon_scopes=['send_notification'], allowed_scopes=None)[source]
classmethod random_addon_key(key_len=16)[source]
class aquarium.server_util.TestServer(server_address, RequestHandlerClass, bind_and_activate=True)[source]
allow_reuse_address = True
aquarium.server_util.capabilities_as_data_uri(doc)[source]
aquarium.server_util.example_capabilities(url, configure_path=None, addon_key=None, scopes=['view_group', 'send_notification'])[source]
aquarium.server_util.with_addon(host='ip-172-30-219-27', use_ssl=False, cert_file='self_signed.crt', key_file='self_signed.key', port=None, param_name='addon')[source]

Decorator that starts a AddonServer and passes it as the param_name (default: ‘addon’) of the decorated method.

Parameters:
  • host
  • use_ssl
  • cert_file
  • key_file
  • port
  • param_name – The name of the injected AddonServer parameter
Returns:

XMPP testing

exception aquarium.sleekclient.ConnectFailed[source]

Generic exception for connection failures (most likely due to failed authentication)

class aquarium.sleekclient.SleekClient(user, password=None, access_token=None, debug=False, use_compression=False, restart_after_auth=False, extra_auth_attributes=None, timeout=5)[source]
archive_room(room)[source]
change_room_privacy(room, privacy)[source]
clear_queue()[source]
connect(address=None, reattempt=True, use_tls=True, use_ssl=False, hostname=None)[source]
delete_room(room, reason='', alt_room='')[source]
get_room_names()[source]
join_room(room)[source]
leave_room(room)[source]
on_auth_failure(stanza)[source]
on_auth_success(stanza)[source]
on_disconnected(event)[source]
on_emoticons(msg)[source]
on_generic_iq_set(msg)[source]
on_message(msg)[source]
on_start(event)[source]
request_private_chat_history(user_jid)[source]
request_room_chat_history(room_jid)[source]
request_room_dictionaries()[source]
request_rooms()[source]
send_emoticons_request()[source]
send_ping()[source]
send_presence(pshow=None, status=None, ppriority=None, pto=None, pfrom=None, ptype=None, pnick=None, client_type=None, client_version=None, client_os_version=None, roster_presences=False)[source]
send_privatechat_message(from_user, to_user, message, id=None)[source]
send_room_message(room, message, id=None, replace=None)[source]
send_startup(send_auto_join_user_presences=False)[source]
unarchive_room(room)[source]
wait_for_message(times=1, timeout=5)[source]

Polling operations

class aquarium.poller.Poller(*args, **kwargs)[source]
test(condition=None)[source]
wait_until(condition=None, seconds=5, raise_on_timeout=True, not_true_as_retry=False)[source]
exception aquarium.poller.RetryException[source]

Atlassian ID

aquarium.aid.account_url()[source]
aquarium.aid.bearer_token()[source]
aquarium.aid.change_password(aid_user_id, password)[source]
aquarium.aid.create_user(name=None, email=None, pwd=None, title=None, prefix='aid', validate_email=True)[source]
aquarium.aid.retrieve_user(aid_user_id)[source]
aquarium.aid.search_user(email)[source]
aquarium.aid.verify_credentials(aid_user_id, password)[source]