constructor tests: create credential files at runtime
This commit is contained in:
pare
14a34396e5
commit
e8d1079562
S'han modificat 3 arxius amb 7 adicions i 6 eliminacions
|
@ -1 +0,0 @@
|
||||||
baz
|
|
|
@ -1,2 +0,0 @@
|
||||||
foo
|
|
||||||
bar
|
|
|
@ -2,10 +2,14 @@ import pytest
|
||||||
from mastodon import Mastodon
|
from mastodon import Mastodon
|
||||||
from mastodon.Mastodon import MastodonIllegalArgumentError
|
from mastodon.Mastodon import MastodonIllegalArgumentError
|
||||||
|
|
||||||
def test_constructor_from_filenames():
|
def test_constructor_from_filenames(tmpdir):
|
||||||
|
client = tmpdir.join('client')
|
||||||
|
client.write_text('foo\nbar\n', 'UTF-8')
|
||||||
|
access = tmpdir.join('access')
|
||||||
|
access.write_text('baz\n', 'UTF-8')
|
||||||
api = Mastodon(
|
api = Mastodon(
|
||||||
'tests/client.credentials',
|
str(client),
|
||||||
access_token = 'tests/access.credentials')
|
access_token = str(access))
|
||||||
assert api.client_id == 'foo'
|
assert api.client_id == 'foo'
|
||||||
assert api.client_secret == 'bar'
|
assert api.client_secret == 'bar'
|
||||||
assert api.access_token == 'baz'
|
assert api.access_token == 'baz'
|
||||||
|
|
Loading…
Referencia en una nova incidència