diff options
author | codl <[email protected]> | 2017-11-27 17:47:15 +0100 |
---|---|---|
committer | codl <[email protected]> | 2017-11-27 17:47:15 +0100 |
commit | e8d10795621730ffdab5be67c913d68e5d9abe07 (patch) | |
tree | 63c9a67c0a26904bfa48d834acfdab099d173986 /tests | |
parent | 14a34396e59cba365de1e53b43ddc0aaf59d191b (diff) | |
download | mastodon.py-e8d10795621730ffdab5be67c913d68e5d9abe07.tar.gz |
constructor tests: create credential files at runtime
Diffstat (limited to 'tests')
-rw-r--r-- | tests/access.credentials | 1 | ||||
-rw-r--r-- | tests/client.credentials | 2 | ||||
-rw-r--r-- | tests/test_constructor.py | 10 |
3 files changed, 7 insertions, 6 deletions
diff --git a/tests/access.credentials b/tests/access.credentials deleted file mode 100644 index 7601807..0000000 --- a/tests/access.credentials +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | baz | ||
diff --git a/tests/client.credentials b/tests/client.credentials deleted file mode 100644 index 3bd1f0e..0000000 --- a/tests/client.credentials +++ /dev/null | |||
@@ -1,2 +0,0 @@ | |||
1 | foo | ||
2 | bar | ||
diff --git a/tests/test_constructor.py b/tests/test_constructor.py index fac3763..a599df6 100644 --- a/tests/test_constructor.py +++ b/tests/test_constructor.py | |||
@@ -2,10 +2,14 @@ import pytest | |||
2 | from mastodon import Mastodon | 2 | from mastodon import Mastodon |
3 | from mastodon.Mastodon import MastodonIllegalArgumentError | 3 | from mastodon.Mastodon import MastodonIllegalArgumentError |
4 | 4 | ||
5 | def test_constructor_from_filenames(): | 5 | def test_constructor_from_filenames(tmpdir): |
6 | client = tmpdir.join('client') | ||
7 | client.write_text('foo\nbar\n', 'UTF-8') | ||
8 | access = tmpdir.join('access') | ||
9 | access.write_text('baz\n', 'UTF-8') | ||
6 | api = Mastodon( | 10 | api = Mastodon( |
7 | 'tests/client.credentials', | 11 | str(client), |
8 | access_token = 'tests/access.credentials') | 12 | access_token = str(access)) |
9 | assert api.client_id == 'foo' | 13 | assert api.client_id == 'foo' |
10 | assert api.client_secret == 'bar' | 14 | assert api.client_secret == 'bar' |
11 | assert api.access_token == 'baz' | 15 | assert api.access_token == 'baz' |