Skip to content

Commit

Permalink
Add tests for same filenames
Browse files Browse the repository at this point in the history
  • Loading branch information
chriskuehl committed Aug 21, 2024
1 parent 493162e commit 7f71737
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ dev: $(VENV) fluffy/static/app.css
test: $(VENV)
$(BIN)/coverage erase
COVERAGE_PROCESS_START=$(CURDIR)/.coveragerc \
$(BIN)/py.test -vv tests/
$(BIN)/py.test --tb=native -vv tests/
$(BIN)/coverage combine
$(BIN)/coverage report

Expand Down
4 changes: 4 additions & 0 deletions tests/integration/paste_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,7 @@ def test_simple_paste_json(running_server):
},
},
}

# The paste's HTML view and raw view should have the same URL minus the extension.
details = req.json()['uploaded_files']['paste']
assert details['raw'].rsplit('/', 1)[1] == details['paste'].replace('.html', '.txt').rsplit('/', 1)[1]
5 changes: 5 additions & 0 deletions tests/integration/upload_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from pyquery import PyQuery as pq

from testing import assert_url_matches_content
from testing import raw_text_url_from_paste_html
from testing import BINARY_TESTCASES
from testing import FILE_CONTENT_TESTCASES
from testing import paste_urls_from_details
Expand Down Expand Up @@ -112,6 +113,10 @@ def test_plaintext_files_are_also_pasted(content, running_server):
content
)

# The paste's HTML view and raw view should have the same URL minus the extension.
raw_url = raw_text_url_from_paste_html(req.text)
assert raw_url.rsplit('/', 1)[1] == url.replace('.html', '.bin').rsplit('/', 1)[1]


@pytest.mark.parametrize('content', BINARY_TESTCASES)
def test_binary_files_are_not_pasted(content, running_server):
Expand Down

0 comments on commit 7f71737

Please sign in to comment.