diff options
author | codl <[email protected]> | 2017-11-27 15:18:18 +0100 |
---|---|---|
committer | codl <[email protected]> | 2017-11-27 15:18:18 +0100 |
commit | ee802d39d0873a15a26ebca9110a55bd27b696d7 (patch) | |
tree | 0fb104cb7f263524a0c392adb3bd52a9425412f2 | |
parent | de17b86f0f2166655c5d1eb1f5b8f76859f2d99c (diff) | |
download | mastodon.py-ee802d39d0873a15a26ebca9110a55bd27b696d7.tar.gz |
add tests for constructor
-rw-r--r-- | access.credentials | 1 | ||||
-rw-r--r-- | client.credentials | 2 | ||||
-rw-r--r-- | tests/test_constructor.py | 21 |
3 files changed, 24 insertions, 0 deletions
diff --git a/access.credentials b/access.credentials new file mode 100644 index 0000000..7601807 --- /dev/null +++ b/access.credentials | |||
@@ -0,0 +1 @@ | |||
baz | |||
diff --git a/client.credentials b/client.credentials new file mode 100644 index 0000000..3bd1f0e --- /dev/null +++ b/client.credentials | |||
@@ -0,0 +1,2 @@ | |||
1 | foo | ||
2 | bar | ||
diff --git a/tests/test_constructor.py b/tests/test_constructor.py new file mode 100644 index 0000000..720f58d --- /dev/null +++ b/tests/test_constructor.py | |||
@@ -0,0 +1,21 @@ | |||
1 | import pytest | ||
2 | from mastodon import Mastodon | ||
3 | from mastodon.Mastodon import MastodonIllegalArgumentError | ||
4 | |||
5 | def test_constructor_from_filenames(): | ||
6 | api = Mastodon( | ||
7 | 'client.credentials', | ||
8 | access_token = 'access.credentials') | ||
9 | assert api.client_id == 'foo' | ||
10 | assert api.client_secret == 'bar' | ||
11 | assert api.access_token == 'baz' | ||
12 | |||
13 | def test_constructor_illegal_ratelimit(): | ||
14 | with pytest.raises(MastodonIllegalArgumentError): | ||
15 | api = Mastodon( | ||
16 | 'foo', client_secret='bar', | ||
17 | ratelimit_method='baz') | ||
18 | |||
19 | def test_constructor_missing_client_secret(): | ||
20 | with pytest.raises(MastodonIllegalArgumentError): | ||
21 | api = Mastodon('foo') | ||