aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcodl <[email protected]>2017-11-27 15:18:18 +0100
committercodl <[email protected]>2017-11-27 15:18:18 +0100
commitee802d39d0873a15a26ebca9110a55bd27b696d7 (patch)
tree0fb104cb7f263524a0c392adb3bd52a9425412f2
parentde17b86f0f2166655c5d1eb1f5b8f76859f2d99c (diff)
downloadmastodon.py-ee802d39d0873a15a26ebca9110a55bd27b696d7.tar.gz
add tests for constructor
-rw-r--r--access.credentials1
-rw-r--r--client.credentials2
-rw-r--r--tests/test_constructor.py21
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 @@
1foo
2bar
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 @@
1import pytest
2from mastodon import Mastodon
3from mastodon.Mastodon import MastodonIllegalArgumentError
4
5def 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
13def test_constructor_illegal_ratelimit():
14 with pytest.raises(MastodonIllegalArgumentError):
15 api = Mastodon(
16 'foo', client_secret='bar',
17 ratelimit_method='baz')
18
19def test_constructor_missing_client_secret():
20 with pytest.raises(MastodonIllegalArgumentError):
21 api = Mastodon('foo')
Powered by cgit v1.2.3 (git 2.41.0)