diff options
author | Lorenz Diener <[email protected]> | 2017-11-29 17:48:56 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2017-11-29 17:48:56 +0100 |
commit | 961425e2abc91d693004f2c0d073e387de64e58c (patch) | |
tree | 8b1512daf97ab63b54f4edebc83b35f524571c53 /tests/test_constructor.py | |
parent | 5b811b719d379be06ed256da2ee806a051461795 (diff) | |
parent | e79987df2410ee32302abed9e486a72b2dfc9707 (diff) | |
download | mastodon.py-961425e2abc91d693004f2c0d073e387de64e58c.tar.gz |
Merge pull request #109 from codl/test-suite
Test suite
Diffstat (limited to 'tests/test_constructor.py')
-rw-r--r-- | tests/test_constructor.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/test_constructor.py b/tests/test_constructor.py new file mode 100644 index 0000000..cdeb962 --- /dev/null +++ b/tests/test_constructor.py | |||
@@ -0,0 +1,25 @@ | |||
1 | import pytest | ||
2 | from mastodon import Mastodon | ||
3 | from mastodon.Mastodon import MastodonIllegalArgumentError | ||
4 | |||
5 | def test_constructor_from_filenames(tmpdir): | ||
6 | client = tmpdir.join('client') | ||
7 | client.write_text(u'foo\nbar\n', 'UTF-8') | ||
8 | access = tmpdir.join('access') | ||
9 | access.write_text(u'baz\n', 'UTF-8') | ||
10 | api = Mastodon( | ||
11 | str(client), | ||
12 | access_token=str(access)) | ||
13 | assert api.client_id == 'foo' | ||
14 | assert api.client_secret == 'bar' | ||
15 | assert api.access_token == 'baz' | ||
16 | |||
17 | def test_constructor_illegal_ratelimit(): | ||
18 | with pytest.raises(MastodonIllegalArgumentError): | ||
19 | api = Mastodon( | ||
20 | 'foo', client_secret='bar', | ||
21 | ratelimit_method='baz') | ||
22 | |||
23 | def test_constructor_missing_client_secret(): | ||
24 | with pytest.raises(MastodonIllegalArgumentError): | ||
25 | api = Mastodon('foo') | ||