Commit graph

396 commits

Author SHA1 Message Date
Frédéric Mangano-Tarumi
127bb4c84c rendercomment: safer Flyspray task linkification
When an FS#123 is part of a code block, it must not be converted into a
link. FS#123 may also appear inside an URL, in which case regular
linkifaction of URLs must take precedence.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2020-02-02 20:49:16 +01:00
Frédéric Mangano-Tarumi
199f34e42e rendercomment: safer auto-linkification of URLs
Fixes a few edge cases:

- URLs within code blocks used to get redundant <> added, breaking bash
  code snippets like `curl https://...` into `curl <https://...>`.

- Links written with markdown's <https://...> syntax also used to get an
  extra pair of brackets.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2020-02-02 12:12:43 +01:00
Frédéric Mangano-Tarumi
0fc69e96bd rendercomment: add a test for Git commit links
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2020-02-02 12:12:43 +01:00
Lukas Fleischer
d0e5c3db69 t2500: fix test cases
Since commit eeaa1c3 (Separate text from footer in notification emails,
2020-01-04), information about unsubscribing from notifications is added
in a signature block. Fix the test cases accordingly.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2020-01-30 13:25:15 +01:00
Lukas Fleischer
ee959c9907 t2500: fix test case for orphan request notifications
Since commit a66c7fa (notify.py: Use a/an correctly when sending request
notifications, 2019-08-09), the body of notification emails sent when
filing orphan requests refers to "an orphan request" instead of "a
orphan request".

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2019-11-23 16:23:00 -05:00
Lukas Fleischer
2422fb020b Store timestamp and user ID when closing requests
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2019-11-23 12:30:46 -05:00
Lukas Fleischer
882c011e74 Upgrade Sharness to 1.1.0
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2019-11-23 12:25:23 -05:00
Lukas Fleischer
8a2f13f8c2 t2500: add test for disown notifications
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2018-08-12 13:41:56 +02:00
Lukas Fleischer
0ae1ca15e9 t2500: use unique identifiers
Use disjoint sets of IDs for users, package bases, package comments and
package requests to ensure the notification script expects the
parameters in the same order we pass them.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2018-08-12 13:40:51 +02:00
Lukas Fleischer
bf5a79da6b Initialize locale directory for tests
Since commit a7865ef (Make the locale directory configurable,
2018-07-22), we need to specify the locale directory in the
configuration file.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2018-08-12 13:40:51 +02:00
Lukas Fleischer
b70f048bc3 Add package base name in request close notifications
Mention both the package base name and the request type in the subject
of request closure notification.

Implements FS#41607.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2018-05-20 16:55:58 +02:00
Lukas Fleischer
f7a57c82bc Localize notification emails
Add support for translating notification emails and send localized
notifications, based on the user's language preferences. Also, update
the translations Makefile to add strings from the notification script
to the message catalog.

Implements FS#31850.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2018-05-17 22:58:54 +02:00
Lukas Fleischer
fec253a65d t2500: Add test cases for all notifications
Check that for all kinds of notifications, the generated messages match
what we expect.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2018-05-17 22:05:33 +02:00
Lukas Fleischer
ce93360257 Erase login IP addresses after seven days
Add a script to periodically remove old IP addresses from the users
database.

The login IP addresses are stored for spam protection and to prevent
from abuse. It is quite unlikely that we ever need the IP address of a
user whose last login is more than a week old. It makes sense to remove
such IP addresses to protect our users' privacy.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2018-05-10 21:38:25 +02:00
Johannes Löthberg
e5b43760c2 Move AUR_OVERWRITE privilege check from git/auth to git/update
git/auth is run as an AutherizedKeysCommand which does not get the
environment variables passed to it, so AUR_OVERWRITE always got
hard-set to '0' by it.  Instead we need to perform the actual privilege
check in git/update instead.

Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2018-01-21 18:09:10 +01:00
Lukas Fleischer
7ef1427678 Fix use of test_must_fail with environment variables
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2017-08-25 07:04:15 +02:00
Lukas Fleischer
2d2bef3513 t1100: Test AUR_OVERWRITE
Since c5302d3 (Require TUs to explicitly request to overwrite a pkgbase,
2017-07-24), non-fast-forward pushes require setting the AUR_OVERWRITE
environment variable. Make sure that git-auth passes this variable to
git-serve when it should (and does not pass it if it shouldn't).

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2017-08-10 15:17:31 +02:00
Lukas Fleischer
e0d3fbfdf1 t1300: Fix test cases for non-fast-forward pushes
Since commit c5302d3 (Require TUs to explicitly request to overwrite a
pkgbase, 2017-07-24), non-fast-forward pushes are denied even for
Trusted Users, unless the AUR_OVERWRITE environment variable is set.
Mark the test case performing a non-fast-forward push from a TU
account as test_must_fail and add another test case performing the
same operation with AUR_OVERWRITE=1.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2017-08-08 15:28:40 +02:00
Lukas Fleischer
d9883ee642 mkpkglists: Generate a list of user names
In addition to the packages list and the package base list, also create
a list of registered user names.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2017-08-01 07:08:29 +02:00
Lukas Fleischer
dec9077339 Initialize PackageRequests.{Comments,ClosureComment}
Since commit 09cb61a (schema: Remove invalid default values for TEXT
columns, 2017-04-15), the PackageRequests.Comments and
PackageRequests.ClosureComment fields no longer have a default value.
Initialize these fields explicitly whenever a new row is added to the
PackageRequests table.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2017-04-25 07:00:53 +02:00
Lukas Fleischer
f4e2d143ad Explicitly initialize PackageBases.FlaggerComment
Since commit 09cb61a (schema: Remove invalid default values for TEXT
columns, 2017-04-15), the PackageBases.FlaggerComment field no longer
has a default value. Initialize this field explicitly whenever a new row
is added to the PackageBases table.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2017-04-25 07:00:52 +02:00
Lukas Fleischer
90ab7c7b83 t1300: Factor out package dumping
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2017-04-25 07:00:23 +02:00
Lukas Fleischer
362ee754e7 Do not keep line breaks in comments
With the new Markdown support, text paragraphs are now properly
converted to HTML paragraphs, so we no longer need to keep line breaks.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2017-04-24 21:10:02 +02:00
Lukas Fleischer
482bd10a8b t2600: Test Markdown and HTML sanitizing
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2017-04-24 17:41:35 +02:00
Lukas Fleischer
bb623fc545 Make references to Git commits clickable
Automatically detect Git commit identifiers, shorten them, and make them
link to the cgit interface.

Implements FS#43290.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2017-04-24 17:41:35 +02:00
Lukas Fleischer
9aa4203c7e Add Markdown support to package comments
Support Markdown syntax in package comments. Among other things, this
makes it easier to paste command line output and patches.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2017-04-23 18:43:26 +02:00
Lukas Fleischer
016b40f99d Render comments when storing them in the database
Instead of converting package comments from plain text to HTML code when
they are displayed, do the conversion when the comment is posted and
store the rendered result in the database. The conversion itself is done
by a Python script which uses Bleach for sanitizing the text.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2017-04-23 18:43:26 +02:00
Lukas Fleischer
9de633b1f2 test/setup.sh: Error out on missing SQLite schema
Instead of making all tests fail, error out during initialization if the
SQLite schema has not been generated.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2017-03-03 20:30:57 +01:00
Lukas Fleischer
da4bd3b59e Add a Makefile to build an SQLite-compatible schema
Allow for automatically converting the schema into a schema that works
with SQLite by running `make` from the schema/ subdirectory. Use the new
Makefile in the test suite.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2017-03-01 20:12:57 +01:00
Lukas Fleischer
33095b3292 t1200: Test IP address log and bans
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2017-01-25 18:42:34 +01:00
Lukas Fleischer
0b09f200c5 t1200: Add tests for vote/unvote
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2017-01-23 09:10:29 +01:00
Lukas Fleischer
6d8edafe77 t1200: Add tests for flag/unflag
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2016-12-20 18:04:46 +01:00
Lukas Fleischer
ba89ad9b9f t1200: Test maintenance mode
Add a test case to ensure that enabling the maintenance mode disables
the SSH interface.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2016-12-20 18:04:46 +01:00
Lukas Fleischer
9dd0d92d61 Add tests for out-of-date notifications
Make sure that out-of-date notifications are sent to package base
maintainers as well as co-maintainers.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2016-11-13 15:40:34 +01:00
Lukas Fleischer
d987d756b0 test/setup.sh: Fix script paths
The scripts were moved to aurweb/scripts/ in commit 3718860 (Make
maintenance scripts installable, 2016-10-17). Update the paths in the
test suite accordingly.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2016-11-13 15:33:02 +01:00
Lukas Fleischer
fc6dc44295 git-serve: Close orphan requests upon disown
When disowning a package base via the SSH interface, auto-accept all
pending orphan requests for the affected package.

Also, add a test case that checks whether (only) orphan requests
belonging to disowned packages are closed correctly.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2016-10-11 22:14:41 +02:00
Lukas Fleischer
29a5f94dab git-update: Catch long source URLs
Bail out early if the source array contains an entry with more than 8000
characters.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2016-10-11 08:36:40 +02:00
Lukas Fleischer
1492444ecb Make URL columns 8000 characters wide
According to RFC 7230, URLs can be up too 8000 characters long. Resize
all URL fields accordingly.

Also, add a test to verify that URLs with more than 8000 characters are
rejected by the update hook.

Reported-by: Andreas Linz <klingt.net@gmail.com>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2016-10-11 08:36:40 +02:00
Lukas Fleischer
d4fe77ac57 Reorganize Git interface scripts
Move the Git interface scripts from git-interface/ to aurweb/git/. Use
setuptools to automatically create wrappers which can be installed using
`python3 setup.py install`. Update the configuration files, the test
suite as well as the INSTALL and README files to reflect these changes.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2016-10-08 14:25:43 +02:00
Lukas Fleischer
bc3a4f348d t2200: Check that only non-voters get reminders
Add a test to make sure that Trusted Users, who already voted on a
proposal, do not receive any reminders.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2016-09-29 22:07:53 +02:00
Lukas Fleischer
eb367d97e2 Use the notify script in tests
Instead of only checking whether the notification script is called with
the correct parameters, actually invoke the real notify script and check
whether proper notifications are generated.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2016-09-29 22:07:24 +02:00
Lukas Fleischer
c8c3747786 Add tests for aurblup
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2016-09-29 22:07:24 +02:00
Lukas Fleischer
d00f4c5197 Add tests for pkgmaint
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2016-09-29 22:07:24 +02:00
Lukas Fleischer
cd2d90612b Add tests for tuvotereminder
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2016-09-29 22:07:24 +02:00
Lukas Fleischer
a48f8ccb13 Add tests for mkpkglists
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2016-09-29 22:07:24 +02:00
Lukas Fleischer
49c7e53572 Reorganize tests
Move and rename the existing git-interface tests such that tests for
other scripts can be added easily.

In particular, the following changes are made:

* Move the existing tests from git-interface/test/ to test/.
* Rename t0001-auth.sh to t1100-git-auth.sh.
* Rename t0002-serve.sh to t1200-git-serve.sh.
* Rename t0003-update.sh to t1300-git-update.sh.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2016-09-29 22:07:24 +02:00