diff options
-rw-r--r-- | tests/test_create_app.py | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/tests/test_create_app.py b/tests/test_create_app.py index 5777caa..8745b47 100644 --- a/tests/test_create_app.py +++ b/tests/test_create_app.py | |||
@@ -26,15 +26,10 @@ def test_create_app(mocker, to_file=None, redirect_uris=None, website=None): | |||
26 | assert app == ('foo', 'bar') | 26 | assert app == ('foo', 'bar') |
27 | assert requests.post.called | 27 | assert requests.post.called |
28 | 28 | ||
29 | def test_create_app_to_file(mocker): | 29 | def test_create_app_to_file(mocker, tmpdir): |
30 | import tempfile, os | 30 | filepath = tmpdir.join('credentials') |
31 | (fd, filename) = tempfile.mkstemp(text=True) | 31 | test_create_app(mocker, to_file=str(filepath)) |
32 | 32 | assert filepath.read_text('UTF-8') == "foo\nbar\n" | |
33 | test_create_app(mocker, to_file=filename) | ||
34 | with os.fdopen(fd) as f: | ||
35 | assert f.read() == "foo\nbar\n" | ||
36 | |||
37 | os.remove(filename) | ||
38 | 33 | ||
39 | def test_create_app_redirect_uris(mocker): | 34 | def test_create_app_redirect_uris(mocker): |
40 | test_create_app(mocker, redirect_uris='http://example.net') | 35 | test_create_app(mocker, redirect_uris='http://example.net') |