add tests for constructor
This commit is contained in:
pare
de17b86f0f
commit
ee802d39d0
S'han modificat 3 arxius amb 24 adicions i 0 eliminacions
1
access.credentials
Normal file
1
access.credentials
Normal file
|
@ -0,0 +1 @@
|
||||||
|
baz
|
2
client.credentials
Normal file
2
client.credentials
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
foo
|
||||||
|
bar
|
21
tests/test_constructor.py
Normal file
21
tests/test_constructor.py
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
import pytest
|
||||||
|
from mastodon import Mastodon
|
||||||
|
from mastodon.Mastodon import MastodonIllegalArgumentError
|
||||||
|
|
||||||
|
def test_constructor_from_filenames():
|
||||||
|
api = Mastodon(
|
||||||
|
'client.credentials',
|
||||||
|
access_token = 'access.credentials')
|
||||||
|
assert api.client_id == 'foo'
|
||||||
|
assert api.client_secret == 'bar'
|
||||||
|
assert api.access_token == 'baz'
|
||||||
|
|
||||||
|
def test_constructor_illegal_ratelimit():
|
||||||
|
with pytest.raises(MastodonIllegalArgumentError):
|
||||||
|
api = Mastodon(
|
||||||
|
'foo', client_secret='bar',
|
||||||
|
ratelimit_method='baz')
|
||||||
|
|
||||||
|
def test_constructor_missing_client_secret():
|
||||||
|
with pytest.raises(MastodonIllegalArgumentError):
|
||||||
|
api = Mastodon('foo')
|
Loading…
Referencia en una nova incidència