diff --git a/tests/data/cleanup.yaml b/tests/data/cleanup.yaml index 4bba8ab..6a416e0 100644 --- a/tests/data/cleanup.yaml +++ b/tests/data/cleanup.yaml @@ -7,8 +7,9 @@ artifactory-cleanup: policies: - name: Remove all files from repo-name-here older then 7 days rules: - - rule: Repo - name: "repo-name-here" + - rule: RepoList + repos: + - "repo-name-here" - rule: DeleteOlderThan days: 7 diff --git a/tests/test_cli.py b/tests/test_cli.py index e91a137..f5c5afe 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -11,6 +11,9 @@ def test_help(capsys): ], exit=False, ) + stdout, stderr = capsys.readouterr() + assert "Usage:" in stdout + assert not stderr assert code == 0 @@ -29,6 +32,7 @@ def test_dry_mode(capsys, shared_datadir, requests_mock): stdout, stderr = capsys.readouterr() assert code == 0, stdout assert "Verbose MODE" in stdout + assert "Destroy MODE" not in stdout assert ( "DEBUG - we would delete 'repo-name-here/path/to/file/filename1.json'" in stdout ) @@ -54,6 +58,7 @@ def test_destroy(capsys, shared_datadir, requests_mock): stdout, stderr = capsys.readouterr() assert code == 0, stdout assert "Destroy MODE" in stdout + assert "Verbose MODE" not in stdout assert ( requests_mock.call_count == 6 diff --git a/tests/test_rules_repo.py b/tests/test_rules_repo.py index aab6693..2022aab 100644 --- a/tests/test_rules_repo.py +++ b/tests/test_rules_repo.py @@ -14,3 +14,11 @@ def test_RepoList(): ] } ] + session = "session" + today = "today" + rule.init(session, today, "arg1", "arg2", "arg3", abc=123) + assert rule.session is None + assert rule.today is None + for repo in rule.repos: + assert repo.session == session + assert repo.today == today