Documentation Helpers

mailman.testing.documentation.dump_msgdata(msgdata, *additional_skips)[source]

Dump in a more readable way a message metadata dictionary.

mailman.testing.documentation.dump_list(list_of_things, key=<class 'str'>)[source]

Print items in a string to get rid of stupid u’’ prefixes.

mailman.testing.documentation.dump_json(url, data=None, method=None, username=None, password=None, sort_entries=None)[source]

Print the JSON dictionary read from a URL.

Parameters
  • url (string) – The url to open, read, and print.

  • data (dict) – Data to use to POST to a URL.

  • method (str) – Alternative HTTP method to use.

  • username (str) – The HTTP Basic Auth user name. None means use the value from the configuration.

  • password (str) – The HTTP Basic Auth password. None means use the value from the configuration.

  • sort_entries (str) – The key to sort entiries.

mailman.testing.documentation.call_http(url, data=None, method=None, username=None, password=None)[source]

‘Call a URL with a given HTTP method and return the resulting object.

The object will have been JSON decoded.

Parameters
  • url (string) – The url to open, read, and print.

  • data (dict) – Data to use to POST to a URL.

  • method (str) – Alternative HTTP method to use.

  • username (str) – The HTTP Basic Auth user name. None means use the value from the configuration.

  • password – The HTTP Basic Auth password. None means use the value from the configuration.

Returns

The decoded JSON data structure.

Raises

HTTPError – when a non-2xx return code is received.

mailman.testing.documentation.cli(command_path)[source]

Call a CLI command in doctests.

Use this to invoke click commands in doctests. This returns a partial that accepts a sequence of command line options, invokes the click command, and returns the results (unless the keyword argument ‘quiet’) is True.

mailman.testing.documentation.run_mailman(args, **overrides)[source]

Execute mailman command with the given arguments and return output.

mailman.app.lifecycle.create_list(fqdn_listname, owners=None, style_name=None)[source]

Create the named list and apply styles.

The mailing may not exist yet, but the domain specified in fqdn_listname must exist.

Parameters
  • fqdn_listname (string) – The fully qualified name for the new mailing list.

  • owners (list of string email addresses) – The mailing list owners.

  • style_name (string) – The name of the style to apply to the newly created list. If not given, the default is taken from the configuration file.

Returns

The new mailing list.

Return type

IMailingList

Raises
  • BadDomainSpecificationError – when the hostname part of fqdn_listname does not exist.

  • ListAlreadyExistsError – when the mailing list already exists.

  • InvalidEmailAddressError – when the fqdn email address is invalid.

  • InvalidListNameError – when the fqdn email address is valid but the listname contains disallowed characters.