Skip to content
Snippets Groups Projects
Commit 9caa1dd5 authored by Jonas Haag's avatar Jonas Haag
Browse files

Add tests for binary files, images and large files

parent b72713dd
No related branches found
No related tags found
No related merge requests found
......@@ -8,4 +8,9 @@
done
)
py.test tests/ -v
tests="$1"
if [ -z "$tests" ]; then
tests="tests/"
fi
py.test $tests -v
#!/bin/bash
#!/bin/bash -e
git init
echo 1 > test
......
......@@ -20,3 +20,21 @@ def test_no_newline_at_end_of_file():
assert "No newline at end of file" in response
assert "2<del></del>" in response
assert "2<ins></ins>" in response
def test_dont_render_binary():
with serve():
response = requests.get(TEST_REPO_DONT_RENDER_URL + "blob/HEAD/binary").content
assert "Binary data not shown" in response
def test_render_image():
with serve():
response = requests.get(TEST_REPO_DONT_RENDER_URL + "blob/HEAD/image.jpg").content
assert '<img src="/dont-render/raw/HEAD/image.jpg"' in response
def test_dont_render_large_file():
with serve():
response = requests.get(TEST_REPO_DONT_RENDER_URL + "blob/HEAD/toolarge").content
assert "Large file not shown" in response
......@@ -19,7 +19,10 @@ AUTH_TEST_REPO_URL = AUTH_TEST_SERVER + TEST_REPO_URL
TEST_REPO_NO_NEWLINE = os.path.abspath("tests/repos/build/no-newline-at-end-of-file")
TEST_REPO_NO_NEWLINE_URL = UNAUTH_TEST_SERVER + "no-newline-at-end-of-file/"
ALL_TEST_REPOS = [TEST_REPO, TEST_REPO_NO_NEWLINE]
TEST_REPO_DONT_RENDER = os.path.abspath("tests/repos/build/dont-render")
TEST_REPO_DONT_RENDER_URL = UNAUTH_TEST_SERVER + "dont-render/"
ALL_TEST_REPOS = [TEST_REPO, TEST_REPO_NO_NEWLINE, TEST_REPO_DONT_RENDER]
@contextlib.contextmanager
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment