aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorcodl <[email protected]>2017-11-27 17:43:37 +0100
committercodl <[email protected]>2017-11-27 17:43:37 +0100
commit14a34396e59cba365de1e53b43ddc0aaf59d191b (patch)
tree6dd32117ce178f5c35a7b3abf08275617e781e8e /tests
parent80b1ce61c91d173829dc4b130a2b5b4fbec76424 (diff)
downloadmastodon.py-14a34396e59cba365de1e53b43ddc0aaf59d191b.tar.gz
use pytest tmpdir fixture instead of making our own temp file
Diffstat (limited to 'tests')
-rw-r--r--tests/test_create_app.py13
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
29def test_create_app_to_file(mocker): 29def 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
39def test_create_app_redirect_uris(mocker): 34def 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')
Powered by cgit v1.2.3 (git 2.41.0)