Commit Graph

33 Commits

Author SHA1 Message Date
Jelle van der Waa
4a11883a7f ruff: enable prefer f-string rule 2023-11-03 12:35:59 +01:00
Jelle van der Waa
6b43ce1407 ruff: enable isort rule 2023-11-03 12:35:59 +01:00
Jelle van der Waa
6883cbea24 mirrors: silence flake8 E721 2023-08-10 10:46:52 +02:00
Jelle van der Waa
8c5a6854e6
mirrors: test for object identity should be is not 2023-05-19 13:42:20 +02:00
Jelle van der Waa
d942027baf mirrors: extend /mirrors/xyz/json/ endpoint
Add the tier / upstream mirror information.

Closes #452
2023-04-11 19:26:41 +02:00
Jelle van der Waa
378d4b0f5d mirrors: convert tests to pytest 2023-02-14 20:22:10 +01:00
Jelle van der Waa
31acd9bda7
Resolve failing checklocation tests
When all tests are run on postgresql the checklocation model is created
and re-created multiples times resulting in the id not always being 1.
Therefore instead of hardcoding the id use the checklocation model to
obtain the database id.

Closes: 285
2021-01-31 16:14:37 +01:00
Justin !
c6cf91a40d Fix pep8 errors 2020-11-11 22:23:29 +01:00
Jelle van der Waa
2146c423fb mirrors: test the MirrorRsync model 2020-02-14 22:47:27 +01:00
Jelle van der Waa
faeaf59293 mirrors: remove duplicate function 2019-02-24 17:40:16 +01:00
Jelle van der Waa
6875265c10 mirrors: tests: add exception handling tests
Include more tests for exception handling cases, refactor this later
using pytest fixture's so there is no need for massive code duplication.
2019-02-21 19:58:10 +01:00
Jelle van der Waa
fdae105d96 mirrors: replace self-written floatvalue with floatformat
In 2013 floatformat was very slow in the mirror status page, these days
floatformat is not that much slower.
2019-02-18 20:56:15 +01:00
Jelle van der Waa
da18435177
switch to python3's buildin mock
Instead of using a python module use the build-in mock and remove the
module from requirements.txt
2019-01-28 21:02:39 +01:00
Jelle van der Waa
32fd54646f mirrors: tests: add exception test cases
Add test cases for 404 and 404 variant url exceptions.
2019-01-21 21:20:19 +01:00
Jelle van der Waa
e0700d40aa mirrors: tests: rename duplicate function
Two functions where called test_valid, rename one.
2019-01-21 21:20:19 +01:00
Jelle van der Waa
a841936204 mirrors: Update mirrorcheck to Python 3
urllib2 has been renamed to urllib and the module layout is changed,
update the code to reflect these changes in Python 3
2019-01-21 21:19:58 +01:00
Jelle van der Waa
ae4b8540f6 mirrors.tests: convert response.content to str 2019-01-21 21:19:58 +01:00
Jelle van der Waa
e8db6e68a5 mirrors.tests: convert response.content to str 2019-01-21 21:19:58 +01:00
Jelle van der Waa
4e08437a33 mirrors: add CheckLocation check 2018-11-30 20:51:33 +01:00
Jelle van der Waa
3cef831148 Fix caching issue in test 2018-09-08 17:37:03 +02:00
Jelle van der Waa
8dcc8c0a70 mirrors: Add a test for generating mirrorlist with status 2018-08-12 19:54:58 +02:00
Jelle van der Waa
d1abef2064 mirrors: add test for mirrorresolv code 2018-07-22 23:57:20 +02:00
Jelle van der Waa
a1b14a4173 Implement cleaning up older log entries in mirrorcheck
MirrorLog entries are not cleaned up by default and will clog the
database. The django settings now defines a retention period in days for
how long to keep mirror logs, on every mirrorcheck run older logs will
be removed from the database.
2018-07-22 22:03:06 +02:00
Jelle van der Waa
ed1f4ce0f3 test: use response.json()
Instead of importing json and loading the response.content using
json.loads use Django's response.json() method.
2018-06-17 22:02:16 +02:00
jelle van der Waa
b94a36e7c6
Merge pull request #105 from kyrias/mirror-list-tier
mirrors: Allow listing mirrors in only a specific tier
2018-05-07 21:44:29 +02:00
Johannes Löthberg
cf0ac9320d mirrors: Add basic status code test for /mirrorlist/tier
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
2018-05-05 21:35:58 +02:00
Genki Sky
a33fd7e265 mirrorlist: Complete /all/https success test case
Also, remove test_generate(), as it was testing no more than
test_mirrorlist_filter() already was.

Signed-off-by: Genki Sky <sky@genki.is>
2018-04-22 19:39:33 +02:00
Genki Sky
a0ce797ded mirrorlist: Accept GET parameters as filters
This fixes a regression. Originally request.REQUEST was used, but django
1.9 removed this. In its stead, request.POST was used unconditionally.
However, this results in any GET request returning *all* mirrors, rather
than filtering as requested in the parameters.

This patch uses POST or GET based on the request method. This fixes the
behavior of the [mirror-filter-form], and any scripts depending on the
generated URL format. Accordingly, make test_mirrorlist_filter() test
both the success and failure cases, rather than just success.

[mirror-filter-form]: https://www.archlinux.org/mirrorlist/

Signed-off-by: Genki Sky <sky@genki.is>
2018-04-22 19:39:30 +02:00
Jelle van der Waa
fe14c23a88 mirrors: Add tests for mirror detail urls
Add tests for mirror detail pages, the json url of the mirror detail
page and the mirror's url detail page.
2018-03-26 21:20:25 +02:00
Jelle van der Waa
8ce83c115c mirrors: remove duplicate test 2018-03-26 21:20:25 +02:00
Jelle van der Waa
538fc2b626 mirrors: Test mirror status with tier specified 2018-03-26 21:20:22 +02:00
jelle van der Waa
148692cd8f More code refactoring / tests (#79)
* main: move tests to main/tests

Move the templatetags tests to main/tests/test_templatetags.

* main: Add test for templatetags country

Create a test for the templatetag country_flag.

* main: remove duplicate floatvalue

floatvalue is only used in the mirrors templates and the same exact
function exists in the mirror_status templatetags.

* main: Remove duplicate hours filter

The hours filter is also defined in the mirror_status and only used in
mirrors.

* main: move percentage filter to mirrors

Move the percentage filter to the only user of it and add a test for
basic use cases.

* main: remove duplicate duration implementation

The duration templatetag filter is also defined in mirror_status.py

* templates: remove unrequired import flags

* main: Add missing testcase for country_flag

Add the None test case, so that the function is fully covered.

* todolists: create tests for Todolist model

Add basic tests for the Todolist model
2018-01-29 14:10:10 -05:00
jelle van der Waa
f42f357fdf Mirror tests (#78)
* mirrors: Move tests to mirrors/tests

Move the tests to separate files in mirrors/tests and expand the model
tests with tests for the Mirror class.

* Add CheckLocation test

* mirrors: Add tests for template filters

Include tests for the filters used in the mirrors views.

* devel: Add tests for template filter in_group

Include a test for a simple case of the in_group filter.
2018-01-22 12:41:39 -05:00