diff options
-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') | ||