mail_deduplicate.tests package

Submodules

mail_deduplicate.tests.conftest module

mail_deduplicate.tests.conftest.invoke(extra_runner)[source]
class mail_deduplicate.tests.conftest.MailFactory(**custom_fields)[source]

Bases: object

Create fake mail messages to serve as unittest fixtures.

Help production of either random, customized or deterministic mail message.

Init the mail with custom fields.

You can bypass data normalization by passing the pre-formatted date string with date_rfc2822 custom field instead of date.

render()[source]

Returns the full, rendered content of the mail.

as_message()[source]

Returns the mail as an instance of mailbox.Message.

static random_string(length)[source]
mail_deduplicate.tests.conftest.make_box(tmp_path)[source]

A generic fixture to produce a temporary box of mails.

The mail container can be created in any format supported by Python standard library, by the way of the box_type parameter. Supported values: only Maildir and mbox for the moment.

mail_deduplicate.tests.conftest.check_box(box_path, box_type, content=None)[source]

Check the content of a mail box (in any of maildir of mbox format).

Does not use set() types internally to avoid silent deduplication. Translates all mails provided to mailbox.Message instances to provide fair comparison in a normalized space.

mail_deduplicate.tests.test_action module

mail_deduplicate.tests.test_action.test_action_definitions()[source]

Test duplicate action definitions.

mail_deduplicate.tests.test_cli module

mail_deduplicate.tests.test_cli.test_bare_call(invoke)[source]
mail_deduplicate.tests.test_cli.test_early_export_file_check(invoke, make_box, tmp_path)[source]

Ensures the export file is tested for existence before any process is ran.

See: https://github.com/kdeldycke/mail-deduplicate/issues/119

mail_deduplicate.tests.test_mail module

mail_deduplicate.tests.test_mail.test_invalid_date_parsing_noop(invoke, make_box)[source]

Mails with strange non-standard dates gets parsed anyway and grouped into duplicate sets.

No deduplication happen: mails groups shares the same metadata.

mail_deduplicate.tests.test_mail.test_invalid_date_parsing_dedup(invoke, make_box)[source]

Mails with strange non-standard dates gets parsed anyway and deduplicated if we reduce the source of hashed headers.

mail_deduplicate.tests.test_mail_box module

mail_deduplicate.tests.test_mail_box.test_nonexistent_path(invoke, source)[source]
mail_deduplicate.tests.test_mail_box.test_invalid_maildir_structure(invoke)[source]

mail_deduplicate.tests.test_strategy module

mail_deduplicate.tests.test_strategy.test_strategy_definitions()[source]

Test deduplication strategy definitions.

mail_deduplicate.tests.test_strategy.test_maildir_dry_run(invoke, make_box, strategy_id, params)[source]

Check no mail is removed in dry-run mode.

mail_deduplicate.tests.test_strategy.test_maildir_strategy(invoke, make_box, strategy_id, mailbox_input, mailbox_results)[source]

Generic test to check the result of a selection strategy.