formatting with black

This commit is contained in:
Hugh Rundle 2024-05-19 12:35:19 +10:00
parent a3de1ecc85
commit 2e4bb69610
No known key found for this signature in database
GPG Key ID: A7E35779918253F9
3 changed files with 19 additions and 9 deletions

View File

@ -274,7 +274,6 @@ def version(vnum):
def schedule(options):
"""
Creates and loads a plist file for scheduled running with launchd. If --time flag is used, the scheduled time is set accordingly. Note that this is designed for use on MacOS.
"""

View File

@ -67,11 +67,11 @@ toot_dict = {
],
},
"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 @@ toot_dict = {
# 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 @@ config_file = {
"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 @@ class MockGitHub:
# 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_archive_response(monkeypatch):
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 alice@test.social."
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 alice@test.social."
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 alice@test.social."
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