-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
19 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
from setuptools import setup | ||
|
||
setup() | ||
setup() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,11 +67,11 @@ | |
], | ||
}, | ||
"media_attachments": [ | ||
{ | ||
"id": 123456789987654321, | ||
"type": "image", | ||
"url": "https://hugh.run/success/accomplished.jpg" | ||
} | ||
{ | ||
"id": 123456789987654321, | ||
"type": "image", | ||
"url": "https://hugh.run/success/accomplished.jpg", | ||
} | ||
], | ||
"mentions": [], | ||
"tags": [], | ||
|
@@ -86,6 +86,7 @@ | |
# NOTE: ensure values in the dict object are what you need: | ||
# it can be mutated by any test before your test runs | ||
|
||
|
||
def dict2obj(d): | ||
# checking whether object d is a | ||
# instance of class list | ||
|
@@ -124,9 +125,10 @@ class C: | |
"toots_to_keep": [103996285277439262, 103976473612749097, 103877521458738491], | ||
"visibility_to_keep": [], | ||
"archive": "archive", | ||
"archive_media": False | ||
"archive_media": False, | ||
} | ||
|
||
|
||
# mock GitHub API call for the version number | ||
class MockGitHub: | ||
@staticmethod | ||
|
@@ -136,7 +138,7 @@ def json(): | |
|
||
# mock image call for archive | ||
class MockMedia: | ||
f = open('tests/accomplished.jpg', 'rb') | ||
f = open("tests/accomplished.jpg", "rb") | ||
content = f.read() | ||
f.close() | ||
|
||
|
@@ -223,6 +225,7 @@ def mock_get(*args, **kwargs): | |
|
||
monkeypatch.setattr(requests, "get", mock_get) | ||
|
||
|
||
######################## | ||
# TESTS # | ||
######################## | ||
|
@@ -241,6 +244,7 @@ def test_archive_toot(tmpdir): | |
file_exists = os.path.exists(p + "/104136090490756999.json") | ||
assert file_exists | ||
|
||
|
||
def test_archive_toot_media(mock_archive_response, tmpdir): | ||
p = tmpdir.mkdir("archive") | ||
config_file["archive"] = str(p) # make archive directory a temp test dir | ||
|
@@ -250,6 +254,7 @@ def test_archive_toot_media(mock_archive_response, tmpdir): | |
config_file["archive_media"] = False | ||
assert image_exists | ||
|
||
|
||
def test_check_batch(capfd, monkeypatch): | ||
config = config_file | ||
options = Namespace(archive_deleted=False) | ||
|
@@ -269,6 +274,7 @@ def test_check_batch(capfd, monkeypatch): | |
output = capfd.readouterr().out.split("\n") | ||
assert output[0] == "Removed 10 toots for [email protected]." | ||
|
||
|
||
def test_check_batch_quiet(capfd, monkeypatch): | ||
config = config_file | ||
options = Namespace(archive_deleted=False, quiet=1) | ||
|
@@ -284,6 +290,7 @@ def test_check_batch_quiet(capfd, monkeypatch): | |
output = capfd.readouterr().out.split("\n") | ||
assert output[0] == "Removed 10 toots for [email protected]." | ||
|
||
|
||
def test_check_batch_quiet_no_toots(capfd, monkeypatch): | ||
config = config_file | ||
options = Namespace(archive_deleted=False, quiet=2) | ||
|
@@ -301,6 +308,7 @@ def test_check_batch_quiet_no_toots(capfd, monkeypatch): | |
output = capfd.readouterr().out | ||
assert output == "" | ||
|
||
|
||
def test_check_batch_qq(capfd, monkeypatch): | ||
config = config_file | ||
options = Namespace(archive_deleted=False, quiet=2) | ||
|
@@ -316,6 +324,7 @@ def test_check_batch_qq(capfd, monkeypatch): | |
output = capfd.readouterr().out.split("\n") | ||
assert output[0] == "Removed 10 toots for [email protected]." | ||
|
||
|
||
def test_check_batch_qq_no_deletes(capfd, monkeypatch): | ||
config = config_file | ||
options = Namespace(archive_deleted=False, quiet=2) | ||
|
@@ -333,6 +342,7 @@ def test_check_batch_qq_no_deletes(capfd, monkeypatch): | |
output = capfd.readouterr().out | ||
assert output == "" | ||
|
||
|
||
def test_check_batch_qqq(capfd, monkeypatch): | ||
config = config_file | ||
options = Namespace(archive_deleted=False, quiet=3) | ||
|
@@ -349,6 +359,7 @@ def test_check_batch_qqq(capfd, monkeypatch): | |
output = capfd.readouterr().out | ||
assert output == "" | ||
|
||
|
||
def test_console_print(capfd): | ||
ephemetoot.console_print( | ||
"test123", Namespace(test=False, hide_skipped=False, quiet=False), False | ||
|