Commit Graph

69 Commits

Author SHA1 Message Date
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