Commit Graph

113 Commits

Author SHA1 Message Date
Ivan Habunek b2626a9aa8
Don't hardcode hostname in tests 2022-12-07 14:02:16 +01:00
Ivan Habunek 4f0c367995
Add post --scheduled-in option for easier scheduling 2022-12-03 15:38:19 +01:00
Ivan Habunek 59b98a7f33
Improve colorize 2022-12-02 08:50:34 +01:00
Ivan Habunek 0e13914fce
Add duration parsing 2022-12-01 10:20:50 +01:00
Ivan Habunek 6ae2ed623a
Add test for scheduled statuses 2022-12-01 08:35:55 +01:00
Ivan Habunek 7b4063fddc
Remove use of deprecated status.text_url 2022-11-30 08:55:46 +01:00
Ivan Habunek c31d588a80
Expand instance tests 2022-11-29 11:06:47 +01:00
Ivan Habunek 7b194880a0
Remove duplicate search api fn 2022-11-27 09:56:58 +01:00
Ivan Habunek 92b9b4ef18
Expand tests 2022-11-26 07:57:49 +01:00
Ivan Habunek 7c1d517506
Fix example dsn 2022-11-24 15:05:41 +01:00
Ivan Habunek b8decb7660
Set up integration tests against a local instance 2022-11-24 11:21:02 +01:00
Ivan Habunek b15cb85a23
Standardize http request method parameters
This allows setting either json or data. Until now we were always using
data and this is not enough for some endpoints.
2022-11-24 11:20:59 +01:00
Ivan Habunek ceedc0e448
Fix timezone to UTC when running tests
fixes #227
2022-11-21 09:06:58 +01:00
Ivan Habunek 22db8eaf2f
Fix tests 2022-11-12 09:55:12 +01:00
Ivan Habunek 54ceefccdc
Fix tests 2021-08-28 21:15:21 +02:00
Ivan Habunek 1ba3240e6a
Fix tests 2020-09-29 10:07:55 +02:00
Sandra Snan 103bc43c26
Reply to non-int, and also longer posts, Pleroma style 2020-09-01 16:11:12 +02:00
Ivan Habunek 2458e8a360
Fix tests for search 2020-01-21 09:37:03 +01:00
Ivan Habunek 65eb1d0e10
Fix tests broken by colors patch 2019-09-08 15:08:24 +02:00
Ivan Habunek 42247f94ba
Fix tests 2019-07-31 09:01:27 +02:00
Ivan Habunek 096664b9dc
Fix tests 2019-04-23 13:16:24 +02:00
Denis Laxalde 204d4d4138 Handle absence of notification in 'notifications' command 2019-02-17 15:02:05 +01:00
Denis Laxalde 6360e4d07d Add a --clear option to "notifications" command 2019-02-17 14:18:51 +01:00
Denis Laxalde 5174a751f2 Implement "notifications" command
The list of notifications is diplayed with each item enclosed within an
horizontal line as for timeline. When a status is involved (when
notification type is "reblog" or "favourite"), we also display the full
status.

Closes #81.
2019-02-17 14:09:56 +01:00
Ivan Habunek 10595be865
Show full account name in timeline 2019-02-15 14:13:11 +01:00
Denis Laxalde f1c8465e63
Add a "reblogged_by" command 2019-02-14 17:58:47 +01:00
Ivan Habunek e6d585ae5d
Nicer timeline output 2019-02-14 17:31:48 +01:00
Ivan Habunek 8a3ff94e47
Consolidate wcwidth-related utils in one module 2019-02-14 15:45:27 +01:00
Ivan Habunek 769ff9e406
Add wcstring utils 2019-02-14 15:23:46 +01:00
Ivan Habunek 8805a50194
Cleanup utils dealing with wcwidth strings 2019-02-14 14:21:53 +01:00
Denis Laxalde 0bf4b2a21a
Fix left column padding in timeline with wide characters
When the left column contains wide characters (which occupy more than
one cell when printed to screen), padding to 30-characters with
"{:30}".format() does not work well. This happens for instance when the
display name contains unicode characters such as emojis.

We fix this by introducing a pad() function in utils module which uses
the wcwidth library (https://pypi.org/project/wcwidth/) to compute the
length of the text for the column. trunc() function is also adjusted to
optionally compute the length of the text to be truncated since, when
called from pad(), we now pre-compute this value.

We update test for timeline rendering so that the display name now
includes an emoji. (Without the fix, the test would not pass as left
column would be misaligned.)
2019-02-14 14:21:53 +01:00
Denis Laxalde 9d6cd87202
Check full output in test_timeline
We're going to update this test in the next commit and having complete
output checked (including padding, column/row separations) will help.
2019-02-14 14:21:53 +01:00
Ivan Habunek 02c392230e
Remove unused import 2019-02-13 15:43:30 +01:00
Ivan Habunek 19cbcd43b2
Make `toot timeline` continuable by pressing Enter 2019-02-13 14:19:00 +01:00
Balazs Nadasdi ee417df60e Status ID + thread view
- Status ID on timeline list view
 - thread command to view a complete thread
   Display order:
    - ancestors
    - status
    - descendants
2019-01-19 19:28:17 +01:00
Denis Laxalde 0f6bd920c3 Replace ' by "'" before parsing HTML
Beautiful will does not parse HTML entities like `'` as we expect
and the previous logic of replacing this *after* HTML parsing occurred
did not produced expected results.

To illustrate this, we change data in "test_timeline" to include a
literal `'` as it sometimes occur in data returned by Mastodon API.
New HTML content is:

    <p>The computer can&apos;t tell you the emotional story [...] </p>

Beautiful will parse this as as:

    <p>The computer can&amp;apost tell you the emotional story [...] </p>

which is not what we expect.

We fix this by replacing `&apos;` *before* HTML parsing by Beautiful.
Since test data in "test_timeline" got updated we also add an extra
assertion checking that part of the content with a literal "'" is
(still) properly rendered.
2019-01-01 23:14:54 +01:00
Ivan Habunek cf1217cc26
Fix tests 2018-06-27 16:29:45 +02:00
Ivan Habunek 72f88831ad
Add delete command
issue #54
2018-06-14 10:40:16 +02:00
Ivan Habunek 025d8dde09
Use Idempotency-Key header when posting toots 2018-06-13 13:22:52 +02:00
Ivan Habunek 8f93b255ad
Add option to reply to a toot
fixes #6
2018-06-13 13:21:22 +02:00
Ivan Habunek b3d81c43cc
Tweak timeline output 2018-06-12 11:43:47 +02:00
Ivan Habunek ce0df5f1b7
Fix tests on Python 3.5 2018-06-09 10:39:08 +02:00
Ivan Habunek fa4e4e6357
Add spoiler text and sensitive options to post
issue #63
2018-06-07 10:06:43 +02:00
Ivan Habunek 9f23ba4d55
Simplify mocking in tests 2018-06-07 10:05:14 +02:00
Mateusz Piotrowski beeb7914a8 Fix XDG_CONFIG_HOME tests
According to the Python documentation[1]:

> Calls to unsetenv() don’t update os.environ, so it is actually
> preferable to delete items of os.environ.

It means that os.unsetenv is not enough to remove an entry from
os.environ. This is why the following test was failing:

    os.unsetenv('XDG_CONFIG_HOME')
    assert fn() == os.path.expanduser('~/.config/toot/config.json')

os.unsetenv did not influence the output of the subsequent call to
os.getenv() in get_config_file_path(). As a result the original value
was returned instead of the fallback value of '~/.config'.

This bug was discovered during porting toot to FreeBSD as the FreeBSD
Ports framework passes XDG_CONFIG_HOME to make's environment.

[1]: https://docs.python.org/3.6/library/os.html#os.unsetenv
2018-04-17 21:09:26 +02:00
Ivan Habunek db4e1d59f3
Add __version__ to init file 2018-01-15 12:19:37 +01:00
Ivan Habunek 455e531194
Respect XDG_CONFIG_HOME env variable
to locate configuration home directory.

fixes #12
2018-01-14 15:29:34 +01:00
Ivan Habunek 6a3c877270
Reimplement configuration to allow multiple logins
The configuration is now stored in a single json encoded file instead of
separate files.
2018-01-02 12:24:32 +01:00
Ivan Habunek 062bd864eb
Fix tests 2017-12-30 18:04:38 +01:00
Ivan Habunek 92d4dc745a
Use http methods instead of requests directly 2017-12-30 16:30:35 +01:00
Ivan Habunek 7bbc98363e
Extract exceptions 2017-12-30 13:32:52 +01:00
Ivan Habunek a50ffe62c3
Extract auth code to own file, add some tests 2017-12-30 13:05:47 +01:00
Ivan Habunek 6766cf83b4
Search only accounts when looking for users
Instead of using general search.
2017-05-07 10:42:04 +02:00
Ivan Habunek 12047cdc92
Fix tests for follow/unfollow 2017-04-20 10:58:49 +02:00
Ivan Habunek 373f26424d
Rework how commands are defined 2017-04-19 14:47:30 +02:00
Ivan Habunek 3f44d560c8
Store access tokens for multiple instances
This makes it so an app is created only once for each instance, instead
of being re-created on each login. Prevents accumulations of authroized
apps in https://mastodon.social/oauth/authorized_applications
2017-04-18 16:16:24 +02:00
Ivan Habunek a666689c8d
Add whoami command 2017-04-16 17:53:02 +02:00
Ivan Habunek a493da5c84
Added follow and unfollow commands 2017-04-16 17:15:05 +02:00
Ivan Habunek 64d46955e2
Add search command 2017-04-16 15:07:27 +02:00
Ivan Habunek d53849fe4b
Extract api functions to api.py 2017-04-16 14:14:33 +02:00
Ivan Habunek d7701bd2e6
Replace deprecated optparse with argparse 2017-04-16 14:06:16 +02:00
Ivan Habunek d21e45899c
Add coding directive 2017-04-15 14:53:08 +02:00
Ivan Habunek 7e31c57a63
Start testing 2017-04-15 14:46:22 +02:00