diff --git a/test/conftest.py b/test/conftest.py index ff6845c..12cba93 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -21,6 +21,15 @@ """ +from os import environ as envr + +import pytest +from gitlab import Gitlab +from requests import Session + +from pagure_exporter.conf import standard + + def wipe_cookies(): def before_record_response(response): response["headers"]["Set-Cookie"] = "" @@ -30,3 +39,30 @@ def before_record_response(response): def pytest_recording_configure(config, vcr): vcr.before_record_response = wipe_cookies() + + +@pytest.fixture(scope="function") +def wipe_issues(): + """ + Clean all existing issue tickets before running the issue creation related tests + """ + + gobj = Gitlab( + url="https://gitlab.com", + private_token=envr['TEST_GKEY'], + timeout=30, + retry_transient_errors=True, + session=Session() + ) + gpro = gobj.projects.get(id=envr["TEST_DEST"]) + + # There are a maximum of 4 issue tickets at https://pagure.io/protop2g-test-srce/issues + # Change this variable if the issue tickets are created or deleted from there + qant = 4 + + for indx in range(1, qant+1): + try: + gpro.issues.delete(str(indx)) + standard.logger.info(f"Issue #{indx} was deleted") + except Exception as expt: + standard.logger.info(f"Issue #{indx} could not be deleted due to {expt}") diff --git a/test/test_tkts.py b/test/test_tkts.py index 6e6a44c..67de631 100644 --- a/test/test_tkts.py +++ b/test/test_tkts.py @@ -26,6 +26,7 @@ import pytest from click.testing import CliRunner +from pagure_exporter.conf import standard from pagure_exporter.main import main @@ -34,36 +35,36 @@ "cmdl, code, text", [ pytest.param( - f"--srce {envr['TEST_SRCE']} --dest {envr['TEST_DEST']} --pkey {envr['TEST_PKEY']} --gkey {envr['TEST_GKEY']} --fusr {envr['TEST_FUSR']} --tusr {envr['TEST_TUSR']} tkts --status OPEN", # noqa: E501 + f"--srce {envr['TEST_SRCE']} --dest {envr['TEST_DEST']} --pkey {envr['TEST_PKEY']} --gkey {envr['TEST_GKEY']} --fusr {envr['TEST_FUSR']} --tusr {envr['TEST_TUSR']} tkts --status OPEN --series", # noqa: E501 0, [ - "[ WARN ] Extracting all open issue tickets without labels, without states, without privacy and without comments off the given selection", # noqa: E501 + "[ WARN ] Extracting all open issue tickets without labels, without states, without privacy, without comments and with order off the given selection", # noqa: E501 "Found 2 issue ticket(s) across 1 page(s) in ", "[ BUSY ] Migrating issue ticket without labels #1 'This is the title of the first test issue' by 'Akashdeep Dhar (ID t0xic0der)'...", # noqa: E501 "Migrated to ", "[ BUSY ] Migrating issue ticket without labels #3 'This is the title of the third test issue' by 'Akashdeep Dhar (ID t0xic0der)'...", # noqa: E501 "Migrated to ", ], - id="Transferring issue tickets with OPEN status without labels, without states, without privacy and without comments", # noqa: E501 + id="Transferring issue tickets with OPEN status without labels, without states, without privacy, without comments and with order", # noqa: E501 ), pytest.param( - f"--srce {envr['TEST_SRCE']} --dest {envr['TEST_DEST']} --pkey {envr['TEST_PKEY']} --gkey {envr['TEST_GKEY']} --fusr {envr['TEST_FUSR']} --tusr {envr['TEST_TUSR']} tkts --status SHUT", # noqa: E501 + f"--srce {envr['TEST_SRCE']} --dest {envr['TEST_DEST']} --pkey {envr['TEST_PKEY']} --gkey {envr['TEST_GKEY']} --fusr {envr['TEST_FUSR']} --tusr {envr['TEST_TUSR']} tkts --status SHUT --series", # noqa: E501 0, [ - "[ WARN ] Extracting all closed issue tickets without labels, without states, without privacy and without comments off the given selection", # noqa: E501 + "[ WARN ] Extracting all closed issue tickets without labels, without states, without privacy, without comments and with order off the given selection", # noqa: E501 "Found 2 issue ticket(s) across 1 page(s) in ", "[ BUSY ] Migrating issue ticket without labels #2 'This is the title of the second test issue' by 'Akashdeep Dhar (ID t0xic0der)'...", # noqa: E501 "Migrated to ", "[ BUSY ] Migrating issue ticket without labels #4 'This is the title of the fourth test issue' by 'Akashdeep Dhar (ID t0xic0der)'...", # noqa: E501 "Migrated to ", ], - id="Transferring issue tickets with SHUT status without labels, without states, without privacy and without comments", # noqa: E501 + id="Transferring issue tickets with SHUT status without labels, without states, without privacy, without comments and with order", # noqa: E501 ), pytest.param( - f"--srce {envr['TEST_SRCE']} --dest {envr['TEST_DEST']} --pkey {envr['TEST_PKEY']} --gkey {envr['TEST_GKEY']} --fusr {envr['TEST_FUSR']} --tusr {envr['TEST_TUSR']} tkts --status FULL", # noqa: E501 + f"--srce {envr['TEST_SRCE']} --dest {envr['TEST_DEST']} --pkey {envr['TEST_PKEY']} --gkey {envr['TEST_GKEY']} --fusr {envr['TEST_FUSR']} --tusr {envr['TEST_TUSR']} tkts --status FULL --series", # noqa: E501 0, [ - "[ WARN ] Extracting all issue tickets without labels, without states, without privacy and without comments off the given selection", # noqa: E501 + "[ WARN ] Extracting all issue tickets without labels, without states, without privacy, without comments and with order off the given selection", # noqa: E501 "Found 4 issue ticket(s) across 1 page(s) in ", "[ BUSY ] Migrating issue ticket without labels #1 'This is the title of the first test issue' by 'Akashdeep Dhar (ID t0xic0der)'...", # noqa: E501 "Migrated to ", @@ -74,7 +75,7 @@ "[ BUSY ] Migrating issue ticket without labels #4 'This is the title of the fourth test issue' by 'Akashdeep Dhar (ID t0xic0der)'...", # noqa: E501 "Migrated to ", ], - id="Transferring issue tickets with FULL status without labels, without states, without privacy and without comments", # noqa: E501 + id="Transferring issue tickets with FULL status without labels, without states, without privacy, without comments and with order", # noqa: E501 ), pytest.param( f"--srce ZEROEXISTENT --dest {envr['TEST_DEST']} --pkey {envr['TEST_PKEY']} --gkey {envr['TEST_GKEY']} --fusr {envr['TEST_FUSR']} --tusr {envr['TEST_TUSR']} tkts", # noqa: E501 @@ -99,10 +100,10 @@ id="Transferring issue tickets to a destination namespace that does not exist", ), pytest.param( - f"--srce {envr['TEST_SRCE']} --dest {envr['TEST_DEST']} --pkey {envr['TEST_PKEY']} --gkey {envr['TEST_GKEY']} --fusr {envr['TEST_FUSR']} --tusr {envr['TEST_TUSR']} tkts --status OPEN --commit", # noqa: E501 + f"--srce {envr['TEST_SRCE']} --dest {envr['TEST_DEST']} --pkey {envr['TEST_PKEY']} --gkey {envr['TEST_GKEY']} --fusr {envr['TEST_FUSR']} --tusr {envr['TEST_TUSR']} tkts --status OPEN --commit --series", # noqa: E501 0, [ - "[ WARN ] Extracting all open issue tickets without labels, with states, without privacy and without comments off the given selection", # noqa: E501 + "[ WARN ] Extracting all open issue tickets without labels, with states, without privacy, without comments and with order off the given selection", # noqa: E501 "Found 2 issue ticket(s) across 1 page(s) in ", "[ BUSY ] Migrating issue ticket without labels #1 'This is the title of the first test issue' by 'Akashdeep Dhar (ID t0xic0der)'...", # noqa: E501 "Migrated to ", @@ -113,13 +114,13 @@ "[ BUSY ] Asserting issue ticket status...", "Assertion unnecessary due to the OPEN status of the ticket", ], - id="Transferring issue tickets with OPEN status along with states but without comments, without privacy and without labels", # noqa: E501 + id="Transferring issue tickets with OPEN status along with states but without comments, without privacy, without labels and with order", # noqa: E501 ), pytest.param( - f"--srce {envr['TEST_SRCE']} --dest {envr['TEST_DEST']} --pkey {envr['TEST_PKEY']} --gkey {envr['TEST_GKEY']} --fusr {envr['TEST_FUSR']} --tusr {envr['TEST_TUSR']} tkts --status SHUT --commit", # noqa: E501 + f"--srce {envr['TEST_SRCE']} --dest {envr['TEST_DEST']} --pkey {envr['TEST_PKEY']} --gkey {envr['TEST_GKEY']} --fusr {envr['TEST_FUSR']} --tusr {envr['TEST_TUSR']} tkts --status SHUT --commit --series", # noqa: E501 0, [ - "[ WARN ] Extracting all closed issue tickets without labels, with states, without privacy and without comments off the given selection", # noqa: E501 + "[ WARN ] Extracting all closed issue tickets without labels, with states, without privacy, without comments and with order off the given selection", # noqa: E501 "Found 2 issue ticket(s) across 1 page(s) in ", "[ BUSY ] Migrating issue ticket without labels #2 'This is the title of the second test issue' by 'Akashdeep Dhar (ID t0xic0der)'...", # noqa: E501 "Migrated to ", @@ -130,40 +131,40 @@ "[ BUSY ] Asserting issue ticket status...", "Asserted CLOSE status of the ticket in ", ], - id="Transferring issue tickets with SHUT status along with states but without comments, without privacy and without labels", # noqa: E501 + id="Transferring issue tickets with SHUT status along with states but without comments, without privacy, without labels and with order", # noqa: E501 ), pytest.param( - f"--srce {envr['TEST_SRCE']} --dest {envr['TEST_DEST']} --pkey {envr['TEST_PKEY']} --gkey {envr['TEST_GKEY']} --fusr {envr['TEST_FUSR']} --tusr {envr['TEST_TUSR']} tkts --status OPEN --secret", # noqa: E501 + f"--srce {envr['TEST_SRCE']} --dest {envr['TEST_DEST']} --pkey {envr['TEST_PKEY']} --gkey {envr['TEST_GKEY']} --fusr {envr['TEST_FUSR']} --tusr {envr['TEST_TUSR']} tkts --status OPEN --secret --series", # noqa: E501 0, [ - "[ WARN ] Extracting all open issue tickets without labels, without states, with privacy and without comments off the given selection", # noqa: E501 + "[ WARN ] Extracting all open issue tickets without labels, without states, with privacy, without comments and with order off the given selection", # noqa: E501 "Found 2 issue ticket(s) across 1 page(s) in ", "[ BUSY ] Migrating issue ticket without labels #1 'This is the title of the first test issue' by 'Akashdeep Dhar (ID t0xic0der)'...", # noqa: E501 "Migrated to ", "[ BUSY ] Migrating issue ticket without labels #3 'This is the title of the third test issue' by 'Akashdeep Dhar (ID t0xic0der)'...", # noqa: E501 "Migrated to ", ], - id="Transferring issue tickets with OPEN status along with privacy but without states, without comments and without labels", # noqa: E501 + id="Transferring issue tickets with OPEN status along with privacy but without states, without comments, without labels and with order", # noqa: E501 ), pytest.param( - f"--srce {envr['TEST_SRCE']} --dest {envr['TEST_DEST']} --pkey {envr['TEST_PKEY']} --gkey {envr['TEST_GKEY']} --fusr {envr['TEST_FUSR']} --tusr {envr['TEST_TUSR']} tkts --status SHUT --secret", # noqa: E501 + f"--srce {envr['TEST_SRCE']} --dest {envr['TEST_DEST']} --pkey {envr['TEST_PKEY']} --gkey {envr['TEST_GKEY']} --fusr {envr['TEST_FUSR']} --tusr {envr['TEST_TUSR']} tkts --status SHUT --secret --series", # noqa: E501 0, [ - "[ WARN ] Extracting all closed issue tickets without labels, without states, with privacy and without comments off the given selection", # noqa: E501 + "[ WARN ] Extracting all closed issue tickets without labels, without states, with privacy, without comments and with order off the given selection", # noqa: E501 "Found 2 issue ticket(s) across 1 page(s) in ", "[ BUSY ] Migrating issue ticket without labels #2 'This is the title of the second test issue' by 'Akashdeep Dhar (ID t0xic0der)'...", # noqa: E501 "Migrated to ", "[ BUSY ] Migrating issue ticket without labels #4 'This is the title of the fourth test issue' by 'Akashdeep Dhar (ID t0xic0der)'...", # noqa: E501 "Migrated to ", ], - id="Transferring issue tickets with SHUT status along with privacy but without states, without comments and without labels", # noqa: E501 + id="Transferring issue tickets with SHUT status along with privacy but without states, without comments, without labels and with order", # noqa: E501 ), pytest.param( - f"--srce {envr['TEST_SRCE']} --dest {envr['TEST_DEST']} --pkey {envr['TEST_PKEY']} --gkey {envr['TEST_GKEY']} --fusr {envr['TEST_FUSR']} --tusr {envr['TEST_TUSR']} tkts --status OPEN --select 1 --commit --comments", # noqa: E501 + f"--srce {envr['TEST_SRCE']} --dest {envr['TEST_DEST']} --pkey {envr['TEST_PKEY']} --gkey {envr['TEST_GKEY']} --fusr {envr['TEST_FUSR']} --tusr {envr['TEST_TUSR']} tkts --status OPEN --select 1 --commit --comments --series", # noqa: E501 0, [ - "[ WARN ] Extracting all open issue tickets without labels, with states, without privacy and with comments off the given selection", # noqa: E501 + "[ WARN ] Extracting all open issue tickets without labels, with states, without privacy, with comments and with order off the given selection", # noqa: E501 "[ BUSY ] Probing issue ticket #1...", "Information retrieved in ", "[ BUSY ] Migrating issue ticket without labels #1 'This is the title of the first test issue' by 'Akashdeep Dhar (ID t0xic0der)'...", # noqa: E501 @@ -179,13 +180,13 @@ "[ BUSY ] Transferring comment (Entity 3 of 3)...", "Transferred to ", ], - id="Transferring particular issue tickets with OPEN status along with states and comments but without labels and without privacy", # noqa: E501 + id="Transferring particular issue tickets with OPEN status along with states and comments but without labels, without privacy and with order", # noqa: E501 ), pytest.param( - f"--srce {envr['TEST_SRCE']} --dest {envr['TEST_DEST']} --pkey {envr['TEST_PKEY']} --gkey {envr['TEST_GKEY']} --fusr {envr['TEST_FUSR']} --tusr {envr['TEST_TUSR']} tkts --status SHUT --select 2 --commit --comments", # noqa: E501 + f"--srce {envr['TEST_SRCE']} --dest {envr['TEST_DEST']} --pkey {envr['TEST_PKEY']} --gkey {envr['TEST_GKEY']} --fusr {envr['TEST_FUSR']} --tusr {envr['TEST_TUSR']} tkts --status SHUT --select 2 --commit --comments --series", # noqa: E501 0, [ - "[ WARN ] Extracting all closed issue tickets without labels, with states, without privacy and with comments off the given selection", # noqa: E501 + "[ WARN ] Extracting all closed issue tickets without labels, with states, without privacy, with comments and with order off the given selection", # noqa: E501 "[ BUSY ] Probing issue ticket #2...", "Information retrieved in ", "[ BUSY ] Migrating issue ticket without labels #2 'This is the title of the second test issue' by 'Akashdeep Dhar (ID t0xic0der)'...", # noqa: E501 @@ -203,23 +204,23 @@ "[ BUSY ] Transferring comment (Entity 4 of 4)...", "Transferred to ", ], - id="Transferring particular issue tickets with SHUT status along with states and comments but without labels and without privacy", # noqa: E501 + id="Transferring particular issue tickets with SHUT status along with states and comments but without labels, without privacy and with order", # noqa: E501 ), pytest.param( - f"--srce {envr['TEST_SRCE']} --dest {envr['TEST_DEST']} --pkey {envr['TEST_PKEY']} --gkey {envr['TEST_GKEY']} --fusr {envr['TEST_FUSR']} --tusr {envr['TEST_TUSR']} tkts --status SHUT --select 1", # noqa: E501 + f"--srce {envr['TEST_SRCE']} --dest {envr['TEST_DEST']} --pkey {envr['TEST_PKEY']} --gkey {envr['TEST_GKEY']} --fusr {envr['TEST_FUSR']} --tusr {envr['TEST_TUSR']} tkts --status SHUT --select 1 --series", # noqa: E501 0, [ - "[ WARN ] Extracting all closed issue tickets without labels, without states, without privacy and without comments off the given selection", # noqa: E501 + "[ WARN ] Extracting all closed issue tickets without labels, without states, without privacy, without comments and with order off the given selection", # noqa: E501 "[ BUSY ] Probing issue ticket #1...", "Skipping issue ticket as the issue ticket status does not match the provided status", # noqa: E501 ], - id="Transferring particular issue tickets with OPEN status without labels, without states, without privacy and without comments when SHUT status is prescribed", # noqa: E501 + id="Transferring particular issue tickets with OPEN status without labels, without states, without privacy, without comments and with order when SHUT status is prescribed", # noqa: E501 ), pytest.param( - f"--srce {envr['TEST_SRCE']} --dest {envr['TEST_DEST']} --pkey {envr['TEST_PKEY']} --gkey {envr['TEST_GKEY']} --fusr {envr['TEST_FUSR']} --tusr {envr['TEST_TUSR']} tkts --status FULL --commit", # noqa: E501 + f"--srce {envr['TEST_SRCE']} --dest {envr['TEST_DEST']} --pkey {envr['TEST_PKEY']} --gkey {envr['TEST_GKEY']} --fusr {envr['TEST_FUSR']} --tusr {envr['TEST_TUSR']} tkts --status FULL --commit --series", # noqa: E501 0, [ - "[ WARN ] Extracting all issue tickets without labels, with states, without privacy and without comments off the given selection", # noqa: E501 + "[ WARN ] Extracting all issue tickets without labels, with states, without privacy, without comments and with order off the given selection", # noqa: E501 "Found 4 issue ticket(s) across 1 page(s) in ", "[ BUSY ] Migrating issue ticket without labels #1 'This is the title of the first test issue' by 'Akashdeep Dhar (ID t0xic0der)'...", # noqa: E501 "Migrated to ", @@ -238,39 +239,39 @@ "[ BUSY ] Asserting issue ticket status...", "Asserted CLOSE status of the ticket in ", ], - id="Transferring issue tickets with FULL status along with states but without comments, without privacy and without labels", # noqa: E501 + id="Transferring issue tickets with FULL status along with states but without comments, without privacy, without labels and with order", # noqa: E501 ), pytest.param( - f"--srce {envr['TEST_SRCE']} --dest {envr['TEST_DEST']} --pkey {envr['TEST_PKEY']} --gkey {envr['TEST_GKEY']} --fusr {envr['TEST_FUSR']} --tusr {envr['TEST_TUSR']} tkts --status OPEN --labels", # noqa: E501 + f"--srce {envr['TEST_SRCE']} --dest {envr['TEST_DEST']} --pkey {envr['TEST_PKEY']} --gkey {envr['TEST_GKEY']} --fusr {envr['TEST_FUSR']} --tusr {envr['TEST_TUSR']} tkts --status OPEN --labels --series", # noqa: E501 0, [ - "[ WARN ] Extracting all open issue tickets with labels, without states, without privacy and without comments off the given selection", # noqa: E501 + "[ WARN ] Extracting all open issue tickets with labels, without states, without privacy, without comments and with order off the given selection", # noqa: E501 "Found 2 issue ticket(s) across 1 page(s) in ", "[ BUSY ] Migrating issue ticket with labels #1 'This is the title of the first test issue' by 'Akashdeep Dhar (ID t0xic0der)'...", # noqa: E501 "Migrated to ", "[ BUSY ] Migrating issue ticket with labels #3 'This is the title of the third test issue' by 'Akashdeep Dhar (ID t0xic0der)'...", # noqa: E501 "Migrated to ", ], - id="Transferring issue tickets with OPEN status along with labels but without states, without privacy and without comments", # noqa: E501 + id="Transferring issue tickets with OPEN status along with labels but without states, without privacy, without comments and with order", # noqa: E501 ), pytest.param( - f"--srce {envr['TEST_SRCE']} --dest {envr['TEST_DEST']} --pkey {envr['TEST_PKEY']} --gkey {envr['TEST_GKEY']} --fusr {envr['TEST_FUSR']} --tusr {envr['TEST_TUSR']} tkts --status SHUT --labels", # noqa: E501 + f"--srce {envr['TEST_SRCE']} --dest {envr['TEST_DEST']} --pkey {envr['TEST_PKEY']} --gkey {envr['TEST_GKEY']} --fusr {envr['TEST_FUSR']} --tusr {envr['TEST_TUSR']} tkts --status SHUT --labels --series", # noqa: E501 0, [ - "[ WARN ] Extracting all closed issue tickets with labels, without states, without privacy and without comments off the given selection", # noqa: E501 + "[ WARN ] Extracting all closed issue tickets with labels, without states, without privacy, without comments and with order off the given selection", # noqa: E501 "Found 2 issue ticket(s) across 1 page(s) in ", "[ BUSY ] Migrating issue ticket with labels #2 'This is the title of the second test issue' by 'Akashdeep Dhar (ID t0xic0der)'...", # noqa: E501 "Migrated to ", "[ BUSY ] Migrating issue ticket with labels #4 'This is the title of the fourth test issue' by 'Akashdeep Dhar (ID t0xic0der)'...", # noqa: E501 "Migrated to ", ], - id="Transferring issue tickets with SHUT status along with labels but without states, without privacy and without comments", # noqa: E501 + id="Transferring issue tickets with SHUT status along with labels but without states, without privacy, without comments and with order", # noqa: E501 ), pytest.param( - f"--srce {envr['TEST_SRCE']} --dest {envr['TEST_DEST']} --pkey {envr['TEST_PKEY']} --gkey {envr['TEST_GKEY']} --fusr {envr['TEST_FUSR']} --tusr {envr['TEST_TUSR']} tkts --status FULL --labels", # noqa: E501 + f"--srce {envr['TEST_SRCE']} --dest {envr['TEST_DEST']} --pkey {envr['TEST_PKEY']} --gkey {envr['TEST_GKEY']} --fusr {envr['TEST_FUSR']} --tusr {envr['TEST_TUSR']} tkts --status FULL --labels --series", # noqa: E501 0, [ - "[ WARN ] Extracting all issue tickets with labels, without states, without privacy and without comments off the given selection", # noqa: E501 + "[ WARN ] Extracting all issue tickets with labels, without states, without privacy, without comments and with order off the given selection", # noqa: E501 "Found 4 issue ticket(s) across 1 page(s) in ", "[ BUSY ] Migrating issue ticket with labels #1 'This is the title of the first test issue' by 'Akashdeep Dhar (ID t0xic0der)'...", # noqa: E501 "Migrated to", @@ -281,13 +282,13 @@ "[ BUSY ] Migrating issue ticket with labels #4 'This is the title of the fourth test issue' by 'Akashdeep Dhar (ID t0xic0der)'...", # noqa: E501 "Migrated to", ], - id="Transferring issue tickets with FULL status along with labels but without states, without privacy and without comments", # noqa: E501 + id="Transferring issue tickets with FULL status along with labels but without states, without privacy, without comments and with order", # noqa: E501 ), pytest.param( - f"--srce {envr['TEST_SRCE']} --dest {envr['TEST_DEST']} --pkey {envr['TEST_PKEY']} --gkey {envr['TEST_GKEY']} --fusr {envr['TEST_FUSR']} --tusr {envr['TEST_TUSR']} tkts --status OPEN --comments", # noqa: E501 + f"--srce {envr['TEST_SRCE']} --dest {envr['TEST_DEST']} --pkey {envr['TEST_PKEY']} --gkey {envr['TEST_GKEY']} --fusr {envr['TEST_FUSR']} --tusr {envr['TEST_TUSR']} tkts --status OPEN --comments --series", # noqa: E501 0, [ - "[ WARN ] Extracting all open issue tickets without labels, without states, without privacy and with comments off the given selection", # noqa: E501 + "[ WARN ] Extracting all open issue tickets without labels, without states, without privacy, with comments and with order off the given selection", # noqa: E501 "Found 2 issue ticket(s) across 1 page(s) in ", "[ BUSY ] Migrating issue ticket without labels #1 'This is the title of the first test issue' by 'Akashdeep Dhar (ID t0xic0der)'...", # noqa: E501 "Migrated to ", @@ -308,13 +309,13 @@ "[ BUSY ] Transferring comment (Entity 2 of 2)...", "Transferred to ", ], - id="Transferring issue tickets with OPEN status along with comments but without labels, without privacy and without states", # noqa: E501 + id="Transferring issue tickets with OPEN status along with comments but without labels, without privacy, without states and with order", # noqa: E501 ), pytest.param( - f"--srce {envr['TEST_SRCE']} --dest {envr['TEST_DEST']} --pkey {envr['TEST_PKEY']} --gkey {envr['TEST_GKEY']} --fusr {envr['TEST_FUSR']} --tusr {envr['TEST_TUSR']} tkts --status SHUT --comments", # noqa: E501 + f"--srce {envr['TEST_SRCE']} --dest {envr['TEST_DEST']} --pkey {envr['TEST_PKEY']} --gkey {envr['TEST_GKEY']} --fusr {envr['TEST_FUSR']} --tusr {envr['TEST_TUSR']} tkts --status SHUT --comments --series", # noqa: E501 0, [ - "[ WARN ] Extracting all closed issue tickets without labels, without states, without privacy and with comments off the given selection", # noqa: E501 + "[ WARN ] Extracting all closed issue tickets without labels, without states, without privacy, with comments and with order off the given selection", # noqa: E501 "Found 2 issue ticket(s) across 1 page(s) in ", "[ BUSY ] Migrating issue ticket without labels #2 'This is the title of the second test issue' by 'Akashdeep Dhar (ID t0xic0der)'...", # noqa: E501 "Migrated to ", @@ -339,13 +340,13 @@ "[ BUSY ] Transferring comment (Entity 3 of 3)...", "Transferred to ", ], - id="Transferring issue tickets with SHUT status along with comments but without labels, without privacy and without states", # noqa: E501 + id="Transferring issue tickets with SHUT status along with comments but without labels, without privacy, without states and with order", # noqa: E501 ), pytest.param( - f"--srce {envr['TEST_SRCE']} --dest {envr['TEST_DEST']} --pkey {envr['TEST_PKEY']} --gkey {envr['TEST_GKEY']} --fusr {envr['TEST_FUSR']} --tusr {envr['TEST_TUSR']} tkts --status FULL --comments", # noqa: E501 + f"--srce {envr['TEST_SRCE']} --dest {envr['TEST_DEST']} --pkey {envr['TEST_PKEY']} --gkey {envr['TEST_GKEY']} --fusr {envr['TEST_FUSR']} --tusr {envr['TEST_TUSR']} tkts --status FULL --comments --series", # noqa: E501 0, [ - "[ WARN ] Extracting all issue tickets without labels, without states, without privacy and with comments off the given selection", # noqa: E501 + "[ WARN ] Extracting all issue tickets without labels, without states, without privacy, with comments and with order off the given selection", # noqa: E501 "Found 4 issue ticket(s) across 1 page(s) in ", "[ BUSY ] Migrating issue ticket without labels #1 'This is the title of the first test issue' by 'Akashdeep Dhar (ID t0xic0der)'...", # noqa: E501 "Migrated to", @@ -388,13 +389,13 @@ "[ BUSY ] Transferring comment (Entity 3 of 3)...", "Transferred to ", ], - id="Transferring issue tickets with FULL status along with comments but without labels, without privacy and without states", # noqa: E501 + id="Transferring issue tickets with FULL status along with comments but without labels, without privacy, without states and with order", # noqa: E501 ), pytest.param( - f"--srce {envr['TEST_SRCE']} --dest {envr['TEST_DEST']} --pkey {envr['TEST_PKEY']} --gkey {envr['TEST_GKEY']} --fusr {envr['TEST_FUSR']} --tusr {envr['TEST_TUSR']} tkts --status OPEN --ranges 1 2", # noqa: E501 + f"--srce {envr['TEST_SRCE']} --dest {envr['TEST_DEST']} --pkey {envr['TEST_PKEY']} --gkey {envr['TEST_GKEY']} --fusr {envr['TEST_FUSR']} --tusr {envr['TEST_TUSR']} tkts --status OPEN --ranges 1 2 --series", # noqa: E501 0, [ - "[ WARN ] Extracting all open issue tickets without labels, without states, without privacy and without comments off the given selection", # noqa: E501 + "[ WARN ] Extracting all open issue tickets without labels, without states, without privacy, without comments and with order off the given selection", # noqa: E501 "[ BUSY ] Probing issue ticket #1...", "Information retrieved in ", "[ BUSY ] Migrating issue ticket without labels #1 'This is the title of the first test issue' by 'Akashdeep Dhar (ID t0xic0der)'...", # noqa: E501 @@ -402,13 +403,13 @@ "[ BUSY ] Probing issue ticket #2...", "Skipping issue ticket as the issue ticket status does not match the provided status", # noqa: E501 ], - id="Transferring issue tickets with OPEN status without labels, without states, without privacy and without comments the identities of which fall in the given range", # noqa: E501 + id="Transferring issue tickets with OPEN status without labels, without states, without privacy, without comments and with order the identities of which fall in the given range", # noqa: E501 ), pytest.param( - f"--srce {envr['TEST_SRCE']} --dest {envr['TEST_DEST']} --pkey {envr['TEST_PKEY']} --gkey {envr['TEST_GKEY']} --fusr {envr['TEST_FUSR']} --tusr {envr['TEST_TUSR']} tkts --status SHUT --ranges 1 2", # noqa: E501 + f"--srce {envr['TEST_SRCE']} --dest {envr['TEST_DEST']} --pkey {envr['TEST_PKEY']} --gkey {envr['TEST_GKEY']} --fusr {envr['TEST_FUSR']} --tusr {envr['TEST_TUSR']} tkts --status SHUT --ranges 1 2 --series", # noqa: E501 0, [ - "[ WARN ] Extracting all closed issue tickets without labels, without states, without privacy and without comments off the given selection", # noqa: E501 + "[ WARN ] Extracting all closed issue tickets without labels, without states, without privacy, without comments and with order off the given selection", # noqa: E501 "[ BUSY ] Probing issue ticket #1...", "Skipping issue ticket as the issue ticket status does not match the provided status", # noqa: E501 "[ BUSY ] Probing issue ticket #2...", @@ -416,13 +417,13 @@ "[ BUSY ] Migrating issue ticket without labels #2 'This is the title of the second test issue' by 'Akashdeep Dhar (ID t0xic0der)'...", # noqa: E501 "Migrated to", ], - id="Transferring issue tickets with SHUT status without labels, without states, without privacy and without comments the identities of which fall in the given range", # noqa: E501 + id="Transferring issue tickets with SHUT status without labels, without states, without privacy, without comments and with order the identities of which fall in the given range", # noqa: E501 ), pytest.param( - f"--srce {envr['TEST_SRCE']} --dest {envr['TEST_DEST']} --pkey {envr['TEST_PKEY']} --gkey {envr['TEST_GKEY']} --fusr {envr['TEST_FUSR']} --tusr {envr['TEST_TUSR']} tkts --status FULL --ranges 1 2", # noqa: E501 + f"--srce {envr['TEST_SRCE']} --dest {envr['TEST_DEST']} --pkey {envr['TEST_PKEY']} --gkey {envr['TEST_GKEY']} --fusr {envr['TEST_FUSR']} --tusr {envr['TEST_TUSR']} tkts --status FULL --ranges 1 2 --series", # noqa: E501 0, [ - "[ WARN ] Extracting all issue tickets without labels, without states, without privacy and without comments off the given selection", # noqa: E501 + "[ WARN ] Extracting all issue tickets without labels, without states, without privacy, without comments and with order off the given selection", # noqa: E501 "[ BUSY ] Probing issue ticket #1...", "Information retrieved in ", "[ BUSY ] Migrating issue ticket without labels #1 'This is the title of the first test issue' by 'Akashdeep Dhar (ID t0xic0der)'...", # noqa: E501 @@ -432,13 +433,13 @@ "[ BUSY ] Migrating issue ticket without labels #2 'This is the title of the second test issue' by 'Akashdeep Dhar (ID t0xic0der)'...", # noqa: E501 "Migrated to", ], - id="Transferring issue tickets with FULL status without labels, without states, without privacy and without comments the identities of which fall in the given range", # noqa: E501 + id="Transferring issue tickets with FULL status without labels, without states, without privacy, without comments and with order the identities of which fall in the given range", # noqa: E501 ), pytest.param( - f"--srce {envr['TEST_SRCE']} --dest {envr['TEST_DEST']} --pkey {envr['TEST_PKEY']} --gkey {envr['TEST_GKEY']} --fusr {envr['TEST_FUSR']} --tusr {envr['TEST_TUSR']} tkts --status OPEN --select 1,2", # noqa: E501 + f"--srce {envr['TEST_SRCE']} --dest {envr['TEST_DEST']} --pkey {envr['TEST_PKEY']} --gkey {envr['TEST_GKEY']} --fusr {envr['TEST_FUSR']} --tusr {envr['TEST_TUSR']} tkts --status OPEN --select 1,2 --series", # noqa: E501 0, [ - "[ WARN ] Extracting all open issue tickets without labels, without states, without privacy and without comments off the given selection", # noqa: E501 + "[ WARN ] Extracting all open issue tickets without labels, without states, without privacy, without comments and with order off the given selection", # noqa: E501 "[ BUSY ] Probing issue ticket #1...", "Information retrieved in ", "[ BUSY ] Migrating issue ticket without labels #1 'This is the title of the first test issue' by 'Akashdeep Dhar (ID t0xic0der)'...", # noqa: E501 @@ -446,13 +447,13 @@ "[ BUSY ] Probing issue ticket #2...", "Skipping issue ticket as the issue ticket status does not match the provided status", # noqa: E501 ], - id="Transferring issue tickets with OPEN status without labels, without states, without privacy and without comments the identities of which fall in the given selection", # noqa: E501 + id="Transferring issue tickets with OPEN status without labels, without states, without privacy, without comments and with order the identities of which fall in the given selection", # noqa: E501 ), pytest.param( - f"--srce {envr['TEST_SRCE']} --dest {envr['TEST_DEST']} --pkey {envr['TEST_PKEY']} --gkey {envr['TEST_GKEY']} --fusr {envr['TEST_FUSR']} --tusr {envr['TEST_TUSR']} tkts --status SHUT --select 1,2", # noqa: E501 + f"--srce {envr['TEST_SRCE']} --dest {envr['TEST_DEST']} --pkey {envr['TEST_PKEY']} --gkey {envr['TEST_GKEY']} --fusr {envr['TEST_FUSR']} --tusr {envr['TEST_TUSR']} tkts --status SHUT --select 1,2 --series", # noqa: E501 0, [ - "[ WARN ] Extracting all closed issue tickets without labels, without states, without privacy and without comments off the given selection", # noqa: E501 + "[ WARN ] Extracting all closed issue tickets without labels, without states, without privacy, without comments and with order off the given selection", # noqa: E501 "[ BUSY ] Probing issue ticket #1...", "Skipping issue ticket as the issue ticket status does not match the provided status", # noqa: E501 "[ BUSY ] Probing issue ticket #2...", @@ -460,13 +461,13 @@ "[ BUSY ] Migrating issue ticket without labels #2 'This is the title of the second test issue' by 'Akashdeep Dhar (ID t0xic0der)'...", # noqa: E501 "Migrated to", ], - id="Transferring issue tickets with SHUT status without labels, without states, without privacy and without comments the identities of which fall in the given selection", # noqa: E501 + id="Transferring issue tickets with SHUT status without labels, without states, without privacy, without comments and with order the identities of which fall in the given selection", # noqa: E501 ), pytest.param( - f"--srce {envr['TEST_SRCE']} --dest {envr['TEST_DEST']} --pkey {envr['TEST_PKEY']} --gkey {envr['TEST_GKEY']} --fusr {envr['TEST_FUSR']} --tusr {envr['TEST_TUSR']} tkts --status FULL --select 1,2", # noqa: E501 + f"--srce {envr['TEST_SRCE']} --dest {envr['TEST_DEST']} --pkey {envr['TEST_PKEY']} --gkey {envr['TEST_GKEY']} --fusr {envr['TEST_FUSR']} --tusr {envr['TEST_TUSR']} tkts --status FULL --select 1,2 --series", # noqa: E501 0, [ - "[ WARN ] Extracting all issue tickets without labels, without states, without privacy and without comments off the given selection", # noqa: E501 + "[ WARN ] Extracting all issue tickets without labels, without states, without privacy, without comments and with order off the given selection", # noqa: E501 "[ BUSY ] Probing issue ticket #1...", "Information retrieved in ", "[ BUSY ] Migrating issue ticket without labels #1 'This is the title of the first test issue' by 'Akashdeep Dhar (ID t0xic0der)'...", # noqa: E501 @@ -476,13 +477,17 @@ "[ BUSY ] Migrating issue ticket without labels #2 'This is the title of the second test issue' by 'Akashdeep Dhar (ID t0xic0der)'...", # noqa: E501 "Migrated to", ], - id="Transferring issue tickets with FULL status without labels, without states, without privacy and without comments the identities of which fall in the given selection", # noqa: E501 + id="Transferring issue tickets with FULL status without labels, without states, without privacy, without comments and with order the identities of which fall in the given selection", # noqa: E501 ), ], ) -def test_main_tkts(caplog, cmdl, code, text): +def test_main_tkts(wipe_issues, caplog, cmdl, code, text): runner = CliRunner() result = runner.invoke(main, cmdl) assert result.exit_code == code # noqa: S101 for indx in text: assert indx in caplog.text # noqa: S101 + + # Changing the shared variable back to its default + # Please check https://github.com/gridhead/protop2g/issues/35 for additional details + standard.issutnfs = 0 diff --git a/test/test_unit_tkts.py b/test/test_unit_tkts.py index 790326a..7c51c79 100644 --- a/test/test_unit_tkts.py +++ b/test/test_unit_tkts.py @@ -439,10 +439,23 @@ def test_unit_iteriden_expt(caplog, srce, dest, pkey, gkey, fusr, tusr, indx, ro ), ], ) -def test_unit_itertkts(caplog, srce, dest, pkey, gkey, fusr, tusr, data, root, tags, rslt): +def test_unit_itertkts( + wipe_issues, + caplog, + srce, + dest, + pkey, + gkey, + fusr, + tusr, + data, + root, + tags, + rslt +): standard.paguuser, standard.pagucode, standard.srcename = fusr, pkey, srce standard.gtlbuser, standard.gtlbcode, standard.destname = tusr, gkey, dest - standard.gtlblink, standard.movetags = root, tags + standard.gtlblink, standard.movetags, standard.sequence = root, tags, True keepsake_gpro = standard.gpro standard.gpro = gtlb(