Rename toot -> witchie (tests)
This commit is contained in:
parent
41fff21b8d
commit
f82e20e171
15 changed files with 60 additions and 60 deletions
|
@ -12,7 +12,7 @@ import subprocess
|
|||
import sys
|
||||
import textwrap
|
||||
import yaml
|
||||
import toot
|
||||
import witchie
|
||||
|
||||
from datetime import date
|
||||
from os import path
|
||||
|
@ -33,11 +33,11 @@ if not changelog_item:
|
|||
print(f"Version `{version}` not found in changelog.", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
if toot.__version__ != version:
|
||||
print(f"toot.__version__ is `{toot.__version__}`, expected {version}.", file=sys.stderr)
|
||||
if witchie.__version__ != version:
|
||||
print(f"witchie.__version__ is `{witchie.__version__}`, expected {version}.", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
dist_version = get_distribution('toot').version
|
||||
dist_version = get_distribution('witchie').version
|
||||
if dist_version != version:
|
||||
print(f"Version in setup.py is `{dist_version}`, expected {version}.", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
@ -49,7 +49,7 @@ if not isinstance(release_date, date):
|
|||
print(f"Release date not set for version `{version}` in the changelog.", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
commit_message = f"toot {version}\n\n"
|
||||
commit_message = f"witchie {version}\n\n"
|
||||
for c in changes:
|
||||
lines = textwrap.wrap(c, 70)
|
||||
initial = True
|
||||
|
|
4
setup.py
4
setup.py
|
@ -19,7 +19,7 @@ setup(
|
|||
author_email='huyngo@disroot.org',
|
||||
url='https://git.sr.ht/~huyngo/witchie/',
|
||||
project_urls={
|
||||
'Documentation': 'https://toot.bezdomni.net/',
|
||||
'Documentation': 'https://man.sr.ht/~huyngo/witchie/',
|
||||
'Issue tracker': 'https://todo.sr.ht/~huyngo/witchie/',
|
||||
},
|
||||
keywords='akkoma',
|
||||
|
@ -62,7 +62,7 @@ setup(
|
|||
},
|
||||
entry_points={
|
||||
'console_scripts': [
|
||||
'toot=toot.console:main',
|
||||
'witchie=witchie.console:main',
|
||||
],
|
||||
}
|
||||
)
|
||||
|
|
|
@ -21,15 +21,15 @@ import pytest
|
|||
import uuid
|
||||
|
||||
from pathlib import Path
|
||||
from toot import api, App, User
|
||||
from toot.console import run_command
|
||||
from toot.exceptions import ApiError, ConsoleError
|
||||
from toot.output import print_out
|
||||
from witchie import api, App, User
|
||||
from witchie.console import run_command
|
||||
from witchie.exceptions import ApiError, ConsoleError
|
||||
from witchie.output import print_out
|
||||
|
||||
|
||||
def pytest_configure(config):
|
||||
import toot.settings
|
||||
toot.settings.DISABLE_SETTINGS = True
|
||||
import witchie.settings
|
||||
witchie.settings.DISABLE_SETTINGS = True
|
||||
|
||||
|
||||
# Mastodon database name, used to confirm user registration without having to click the link
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import json
|
||||
|
||||
from toot import App, User, api
|
||||
from toot.entities import Account, Relationship, from_dict
|
||||
from witchie import App, User, api
|
||||
from witchie.entities import Account, Relationship, from_dict
|
||||
|
||||
|
||||
def test_whoami(user: User, run):
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from tests.integration.conftest import TRUMPET
|
||||
from toot import api
|
||||
from toot.entities import Account, from_dict
|
||||
from toot.utils import get_text
|
||||
from witchie import api
|
||||
from witchie.entities import Account, from_dict
|
||||
from witchie.utils import get_text
|
||||
|
||||
|
||||
def test_update_account_no_options(run):
|
||||
|
|
|
@ -5,8 +5,8 @@ import uuid
|
|||
from datetime import datetime, timedelta, timezone
|
||||
from os import path
|
||||
from tests.integration.conftest import ASSETS_DIR, posted_status_id
|
||||
from toot import CLIENT_NAME, CLIENT_WEBSITE, api
|
||||
from toot.utils import get_text
|
||||
from witchie import CLIENT_NAME, CLIENT_WEBSITE, api
|
||||
from witchie.utils import get_text
|
||||
from unittest import mock
|
||||
|
||||
|
||||
|
@ -258,7 +258,7 @@ def test_media_attachments(app, user, run):
|
|||
assert a4["description"] == "Test 4"
|
||||
|
||||
|
||||
@mock.patch("toot.utils.multiline_input")
|
||||
@mock.patch("witchie.utils.multiline_input")
|
||||
@mock.patch("sys.stdin.read")
|
||||
def test_media_attachment_without_text(mock_read, mock_ml, app, user, run):
|
||||
# No status from stdin or readline
|
||||
|
|
|
@ -3,9 +3,9 @@ from pprint import pprint
|
|||
import pytest
|
||||
import re
|
||||
|
||||
from toot import api
|
||||
from toot.entities import Account, from_dict_list
|
||||
from toot.exceptions import ConsoleError
|
||||
from witchie import api
|
||||
from witchie.entities import Account, from_dict_list
|
||||
from witchie.exceptions import ConsoleError
|
||||
from uuid import uuid4
|
||||
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@ import json
|
|||
import time
|
||||
import pytest
|
||||
|
||||
from toot import api
|
||||
from toot.exceptions import NotFoundError
|
||||
from witchie import api
|
||||
from witchie.exceptions import NotFoundError
|
||||
|
||||
|
||||
def test_delete(app, user, run):
|
||||
|
|
|
@ -2,12 +2,12 @@ import pytest
|
|||
|
||||
from unittest import mock
|
||||
|
||||
from toot import App, CLIENT_NAME, CLIENT_WEBSITE
|
||||
from toot.api import create_app, login, SCOPES, AuthenticationError
|
||||
from witchie import App, CLIENT_NAME, CLIENT_WEBSITE
|
||||
from witchie.api import create_app, login, SCOPES, AuthenticationError
|
||||
from tests.utils import MockResponse
|
||||
|
||||
|
||||
@mock.patch('toot.http.anon_post')
|
||||
@mock.patch('witchie.http.anon_post')
|
||||
def test_create_app(mock_post):
|
||||
mock_post.return_value = MockResponse({
|
||||
'client_id': 'foo',
|
||||
|
@ -24,7 +24,7 @@ def test_create_app(mock_post):
|
|||
})
|
||||
|
||||
|
||||
@mock.patch('toot.http.anon_post')
|
||||
@mock.patch('witchie.http.anon_post')
|
||||
def test_login(mock_post):
|
||||
app = App('bigfish.software', 'https://bigfish.software', 'foo', 'bar')
|
||||
|
||||
|
@ -50,7 +50,7 @@ def test_login(mock_post):
|
|||
'https://bigfish.software/oauth/token', data=data, allow_redirects=False)
|
||||
|
||||
|
||||
@mock.patch('toot.http.anon_post')
|
||||
@mock.patch('witchie.http.anon_post')
|
||||
def test_login_failed(mock_post):
|
||||
app = App('bigfish.software', 'https://bigfish.software', 'foo', 'bar')
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import os
|
||||
import pytest
|
||||
|
||||
from toot import User, App, config
|
||||
from witchie import User, App, config
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
@ -128,12 +128,12 @@ def test_get_config_file_path():
|
|||
os.unsetenv('XDG_CONFIG_HOME')
|
||||
os.environ.pop('XDG_CONFIG_HOME', None)
|
||||
|
||||
assert fn() == os.path.expanduser('~/.config/toot/config.json')
|
||||
assert fn() == os.path.expanduser('~/.config/witchie/config.json')
|
||||
|
||||
os.environ['XDG_CONFIG_HOME'] = '/foo/bar/config'
|
||||
|
||||
assert fn() == '/foo/bar/config/toot/config.json'
|
||||
assert fn() == '/foo/bar/config/witchie/config.json'
|
||||
|
||||
os.environ['XDG_CONFIG_HOME'] = '~/foo/config'
|
||||
|
||||
assert fn() == os.path.expanduser('~/foo/config/toot/config.json')
|
||||
assert fn() == os.path.expanduser('~/foo/config/witchie/config.json')
|
||||
|
|
|
@ -5,8 +5,8 @@ import re
|
|||
from collections import namedtuple
|
||||
from unittest import mock
|
||||
|
||||
from toot import console, User, App, http
|
||||
from toot.exceptions import ConsoleError
|
||||
from witchie import console, User, App, http
|
||||
from witchie.exceptions import ConsoleError
|
||||
|
||||
from tests.utils import MockResponse
|
||||
|
||||
|
@ -24,11 +24,11 @@ def uncolorize(text):
|
|||
def test_print_usage(capsys):
|
||||
console.print_usage()
|
||||
out, err = capsys.readouterr()
|
||||
assert "toot - a Mastodon CLI client" in out
|
||||
assert "witchie - a Mastodon CLI client" in out
|
||||
|
||||
|
||||
@mock.patch('uuid.uuid4')
|
||||
@mock.patch('toot.http.post')
|
||||
@mock.patch('witchie.http.post')
|
||||
def test_post_defaults(mock_post, mock_uuid, capsys):
|
||||
mock_uuid.return_value = MockUuid("rock-on")
|
||||
mock_post.return_value = MockResponse({
|
||||
|
@ -51,7 +51,7 @@ def test_post_defaults(mock_post, mock_uuid, capsys):
|
|||
|
||||
|
||||
@mock.patch('uuid.uuid4')
|
||||
@mock.patch('toot.http.post')
|
||||
@mock.patch('witchie.http.post')
|
||||
def test_post_with_options(mock_post, mock_uuid, capsys):
|
||||
mock_uuid.return_value = MockUuid("up-the-irons")
|
||||
args = [
|
||||
|
@ -105,7 +105,7 @@ def test_post_invalid_media(capsys):
|
|||
assert "can't open 'does_not_exist.jpg'" in err
|
||||
|
||||
|
||||
@mock.patch('toot.http.delete')
|
||||
@mock.patch('witchie.http.delete')
|
||||
def test_delete(mock_delete, capsys):
|
||||
console.run_command(app, user, 'delete', ['12321'])
|
||||
|
||||
|
@ -116,7 +116,7 @@ def test_delete(mock_delete, capsys):
|
|||
assert not err
|
||||
|
||||
|
||||
@mock.patch('toot.http.get')
|
||||
@mock.patch('witchie.http.get')
|
||||
def test_timeline(mock_get, monkeypatch, capsys):
|
||||
mock_get.return_value = MockResponse([{
|
||||
'id': '111111111111111111',
|
||||
|
@ -152,7 +152,7 @@ def test_timeline(mock_get, monkeypatch, capsys):
|
|||
assert err == ""
|
||||
|
||||
|
||||
@mock.patch('toot.http.get')
|
||||
@mock.patch('witchie.http.get')
|
||||
def test_timeline_with_re(mock_get, monkeypatch, capsys):
|
||||
mock_get.return_value = MockResponse([{
|
||||
'id': '111111111111111111',
|
||||
|
@ -196,7 +196,7 @@ def test_timeline_with_re(mock_get, monkeypatch, capsys):
|
|||
assert err == ""
|
||||
|
||||
|
||||
@mock.patch('toot.http.post')
|
||||
@mock.patch('witchie.http.post')
|
||||
def test_upload(mock_post, capsys):
|
||||
mock_post.return_value = MockResponse({
|
||||
'id': 123,
|
||||
|
@ -218,7 +218,7 @@ def test_upload(mock_post, capsys):
|
|||
assert __file__ in out
|
||||
|
||||
|
||||
@mock.patch('toot.http.get')
|
||||
@mock.patch('witchie.http.get')
|
||||
def test_whoami(mock_get, capsys):
|
||||
mock_get.return_value = MockResponse({
|
||||
'acct': 'ihabunek',
|
||||
|
@ -256,7 +256,7 @@ def test_whoami(mock_get, capsys):
|
|||
assert "Statuses: 19" in out
|
||||
|
||||
|
||||
@mock.patch('toot.http.get')
|
||||
@mock.patch('witchie.http.get')
|
||||
def test_notifications(mock_get, capsys):
|
||||
mock_get.return_value = MockResponse([{
|
||||
'id': '1',
|
||||
|
@ -365,7 +365,7 @@ def test_notifications(mock_get, capsys):
|
|||
])
|
||||
|
||||
|
||||
@mock.patch('toot.http.get')
|
||||
@mock.patch('witchie.http.get')
|
||||
def test_notifications_empty(mock_get, capsys):
|
||||
mock_get.return_value = MockResponse([])
|
||||
|
||||
|
@ -380,7 +380,7 @@ def test_notifications_empty(mock_get, capsys):
|
|||
assert out == "No notification\n"
|
||||
|
||||
|
||||
@mock.patch('toot.http.post')
|
||||
@mock.patch('witchie.http.post')
|
||||
def test_notifications_clear(mock_post, capsys):
|
||||
console.run_command(app, user, 'notifications', ['--clear'])
|
||||
out, err = capsys.readouterr()
|
||||
|
@ -400,8 +400,8 @@ def u(user_id, access_token="abc"):
|
|||
}
|
||||
|
||||
|
||||
@mock.patch('toot.config.save_config')
|
||||
@mock.patch('toot.config.load_config')
|
||||
@mock.patch('witchie.config.save_config')
|
||||
@mock.patch('witchie.config.load_config')
|
||||
def test_logout(mock_load, mock_save, capsys):
|
||||
mock_load.return_value = {
|
||||
"users": {
|
||||
|
@ -424,8 +424,8 @@ def test_logout(mock_load, mock_save, capsys):
|
|||
assert "✓ User king@gizzard.social logged out" in out
|
||||
|
||||
|
||||
@mock.patch('toot.config.save_config')
|
||||
@mock.patch('toot.config.load_config')
|
||||
@mock.patch('witchie.config.save_config')
|
||||
@mock.patch('witchie.config.load_config')
|
||||
def test_activate(mock_load, mock_save, capsys):
|
||||
mock_load.return_value = {
|
||||
"users": {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from toot.output import colorize, strip_tags, STYLES
|
||||
from witchie.output import colorize, strip_tags, STYLES
|
||||
|
||||
reset = STYLES["reset"]
|
||||
red = STYLES["red"]
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
from argparse import ArgumentTypeError
|
||||
import pytest
|
||||
|
||||
from toot.console import duration
|
||||
from toot.wcstring import wc_wrap, trunc, pad, fit_text
|
||||
from toot.utils import urlencode_url
|
||||
from witchie.console import duration
|
||||
from witchie.wcstring import wc_wrap, trunc, pad, fit_text
|
||||
from witchie.utils import urlencode_url
|
||||
|
||||
|
||||
def test_pad():
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import toot
|
||||
import witchie
|
||||
from pkg_resources import get_distribution
|
||||
|
||||
|
||||
def test_version():
|
||||
"""Version specified in __version__ should be the same as the one
|
||||
specified in setup.py."""
|
||||
assert toot.__version__ == get_distribution('toot').version
|
||||
assert witchie.__version__ == get_distribution('witchie').version
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
from urwid import Divider, Filler, Pile
|
||||
from toot.tui.richtext import url_to_widget
|
||||
from witchie.tui.richtext import url_to_widget
|
||||
from urwidgets import Hyperlink, TextEmbed
|
||||
|
||||
from toot.tui.richtext.richtext import html_to_widgets
|
||||
from witchie.tui.richtext.richtext import html_to_widgets
|
||||
|
||||
|
||||
def test_url_to_widget():
|
||||
|
|
Loading…
Add table
Reference in a new issue