diff options
author | John Turner <jturner.usa@gmail.com> | 2025-09-20 13:23:44 -0400 |
---|---|---|
committer | John Turner <jturner.usa@gmail.com> | 2025-09-20 13:23:44 -0400 |
commit | da239df77ea1aaee8dac08a8dac2d65a9bfee342 (patch) | |
tree | 18156214799f444fcbac211a9b16ba3b954fce0e /tests/test_client_zen.py | |
parent | 63b070473448ad5c7fdcdc3e42befb4792b177a7 (diff) | |
download | pypaste-da239df77ea1aaee8dac08a8dac2d65a9bfee342.tar.gz |
add test_client_zen.py
Diffstat (limited to 'tests/test_client_zen.py')
-rw-r--r-- | tests/test_client_zen.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/test_client_zen.py b/tests/test_client_zen.py new file mode 100644 index 0000000..df3b03f --- /dev/null +++ b/tests/test_client_zen.py @@ -0,0 +1,34 @@ +import sys +import tempfile +import subprocess +import requests + + +def test_upload_file() -> None: + with tempfile.NamedTemporaryFile() as f: + f.write(b"hello world") + f.flush() + + proc = subprocess.run( + ["python", "-m", "pypaste.client", "zen", "--file", f.name], + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + ) + + assert proc.returncode == 0 + + url = proc.stdout.decode().strip() + + req = requests.get(url, params={"raw": "true"}) + + assert "hello world" in req.text + + +def main() -> int: + test_upload_file() + + return 0 + + +if __name__ == "__main__": + sys.exit(main()) |