mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
Makefile: run pytest units
Important note: Python tests will repeatedly clear out tables that they test against; for this reason, one should always run the shell tests first. The __init__.py file is necessary for coverage to collect data from the tests being run. At this point in FastAPI development, I'd like to encourage a few things going forward: 1. Any time you contribute to the FastAPI codebase, you **must** maintain equal or increased coverage on the overall source. Developers are highly appreciated for adding tests in your specific domain of addition or modification that may be missing coverage. Our goal is 100% coverage, and all newly added files **must** have 100% coverage through tests. 2. All source should be formatted with the autopep8 tool and kept within an 80 column width, with the exception of HTML templates. Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
parent
4230772e3b
commit
e800cefe95
14 changed files with 175 additions and 145 deletions
|
@ -10,7 +10,7 @@ test_expect_success 'Test comment rendering.' '
|
|||
INSERT INTO PackageComments (ID, PackageBaseID, Comments, RenderedComment) VALUES (1, 1, "Hello world!
|
||||
This is a comment.", "");
|
||||
EOD
|
||||
"$RENDERCOMMENT" 1 &&
|
||||
cover "$RENDERCOMMENT" 1 &&
|
||||
cat <<-EOD >expected &&
|
||||
<p>Hello world!
|
||||
This is a comment.</p>
|
||||
|
@ -25,7 +25,7 @@ test_expect_success 'Test Markdown conversion.' '
|
|||
cat <<-EOD | sqlite3 aur.db &&
|
||||
INSERT INTO PackageComments (ID, PackageBaseID, Comments, RenderedComment) VALUES (2, 1, "*Hello* [world](https://www.archlinux.org/)!", "");
|
||||
EOD
|
||||
"$RENDERCOMMENT" 2 &&
|
||||
cover "$RENDERCOMMENT" 2 &&
|
||||
cat <<-EOD >expected &&
|
||||
<p><em>Hello</em> <a href="https://www.archlinux.org/">world</a>!</p>
|
||||
EOD
|
||||
|
@ -39,7 +39,7 @@ test_expect_success 'Test HTML sanitizing.' '
|
|||
cat <<-EOD | sqlite3 aur.db &&
|
||||
INSERT INTO PackageComments (ID, PackageBaseID, Comments, RenderedComment) VALUES (3, 1, "<script>alert(""XSS!"");</script>", "");
|
||||
EOD
|
||||
"$RENDERCOMMENT" 3 &&
|
||||
cover "$RENDERCOMMENT" 3 &&
|
||||
cat <<-EOD >expected &&
|
||||
<script>alert("XSS!");</script>
|
||||
EOD
|
||||
|
@ -61,7 +61,7 @@ test_expect_success 'Test link conversion.' '
|
|||
[arch]: https://www.archlinux.org/
|
||||
", "");
|
||||
EOD
|
||||
"$RENDERCOMMENT" 4 &&
|
||||
cover "$RENDERCOMMENT" 4 &&
|
||||
cat <<-EOD >expected &&
|
||||
<p>Visit <a href="https://www.archlinux.org/#_test_">https://www.archlinux.org/#_test_</a>.
|
||||
Visit <em><a href="https://www.archlinux.org/">https://www.archlinux.org/</a></em>.
|
||||
|
@ -89,7 +89,7 @@ test_expect_success 'Test Git commit linkification.' '
|
|||
http://example.com/$oid
|
||||
", "");
|
||||
EOD
|
||||
"$RENDERCOMMENT" 5 &&
|
||||
cover "$RENDERCOMMENT" 5 &&
|
||||
cat <<-EOD >expected &&
|
||||
<p><a href="https://aur.archlinux.org/cgit/aur.git/log/?h=foobar&id=${oid:0:12}">${oid:0:12}</a>
|
||||
<a href="https://aur.archlinux.org/cgit/aur.git/log/?h=foobar&id=${oid:0:7}">${oid:0:7}</a>
|
||||
|
@ -116,7 +116,7 @@ test_expect_success 'Test Flyspray issue linkification.' '
|
|||
https://archlinux.org/?test=FS#1234
|
||||
", "");
|
||||
EOD
|
||||
"$RENDERCOMMENT" 6 &&
|
||||
cover "$RENDERCOMMENT" 6 &&
|
||||
cat <<-EOD >expected &&
|
||||
<p><a href="https://bugs.archlinux.org/task/1234567">FS#1234567</a>.
|
||||
<em><a href="https://bugs.archlinux.org/task/1234">FS#1234</a></em>
|
||||
|
@ -142,7 +142,7 @@ test_expect_success 'Test headings lowering.' '
|
|||
###### Six
|
||||
", "");
|
||||
EOD
|
||||
"$RENDERCOMMENT" 7 &&
|
||||
cover "$RENDERCOMMENT" 7 &&
|
||||
cat <<-EOD >expected &&
|
||||
<h5>One</h5>
|
||||
<h6>Two</h6>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue