Commit Graph

279 Commits

Author SHA1 Message Date
Jelle van der Waa
2146c423fb mirrors: test the MirrorRsync model 2020-02-14 22:47:27 +01:00
Jelle van der Waa
c3773e36e8 mirrors: IPNetworkField context parameter is deprecated
In Django 3.0 the context parameter will be removed.
2019-04-05 16:26:05 +02:00
Jelle van der Waa
faeaf59293 mirrors: remove duplicate function 2019-02-24 17:40:16 +01:00
Fledermann
2cf39148de Decode subprocess output 2019-02-22 20:17:35 +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
923b674a8b mirrors: remove unused import 2019-01-21 21:20:19 +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
632a5073d9 mirrors: types.StringTypes does not exists in Python 3 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
45e7fddd81 mirrors: fix leftover unicode 2019-01-21 21:19:58 +01:00
Jelle van der Waa
b8b85e7f21 Update migrations for Python 3 2019-01-21 21:19:58 +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
Frank Vanderham
0ca04132d0 Refactor Python 3 __unicode__ to __str__
In Python 3 for Django, class method __unicode__ must be changed to
__str__. This commit replaces all models that use __unicode__ to
__str__.
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
c612b19314 main: run 2to3 2019-01-21 21:19:58 +01:00
Jelle van der Waa
19bc060453 mirrors: Update urlparse imports for Python 3 2019-01-21 21:19:58 +01:00
Jelle van der Waa
b911b3308e Remove all squashed migrations
this makes it easier to upgrade to Python 3 since less on_delete lines
have to be fixed.
2019-01-21 21:19:58 +01:00
jelle van der Waa
21211d3cb4
Merge pull request #154 from jelly/squashmigrations
squash all migrations
2018-12-16 15:29:02 +01:00
Jelle van der Waa
4e08437a33 mirrors: add CheckLocation check 2018-11-30 20:51:33 +01:00
Jelle van der Waa
3fc26cdb27 Squash all migrations 2018-11-17 21:58:50 +01:00
Jelle van der Waa
9354c4407d Fix Foreignkey implicit on_delete on django < 2.0
Foreignkey used to implicitly be on_delete=models.CASCADE and has to be
explicit now.
2018-11-17 15:38:12 +01:00
Jelle van der Waa
49bec38981 Using user.is_authenticated() as a method is deprecated
Use is_authenticated as an attribute.
2018-11-17 15:30:58 +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
e4f22521ed QuerySet is an iterable, remove unrequired list(urls) 2018-07-22 18:20:51 +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
Frank Vanderham
9540066f10 Replace deprecated method warn() with warning()
Replaced the deprecated logger.warn() with logger.warning(). This was
causing pylint to return code 4.
2018-05-19 22:51:27 +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
Johannes Löthberg
a9802cd379 mirrors: Allow listing mirrors in only a specific tier
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
2018-05-05 21:24:19 +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
6c6b4541b5 Update urls.py to non relative imports 2018-04-08 12:51:19 +02:00
Johannes Löthberg
996ef6ec72 Change urls.py from patterns to list of url()
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
2018-04-08 12:51:19 +02:00
Jelle van der Waa
42f34783da mirrorresolv: update to Djang 1.10
Update to BaseCommand.
2018-04-08 12:51:19 +02:00
Jelle van der Waa
a73e8d1a31 mirrorcheck: Update to Django 1.10
Use BaseCommand instead of the deprecated NoArgsCommand.
2018-04-08 12:51:19 +02:00
Jelle van der Waa
13eccfe63c Stop using deprecated SubFieldBase 2018-04-08 12:51:19 +02:00
Jelle van der Waa
dfb7be585f request.REQUEST is removed in django 1.9
Replace request.REQUEST with request.POST.
2018-04-08 12:51:19 +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
a9eae9ad70 FS#50516: mirrors: Extend /mirrors/status/json/ (#91)
Add the ipv4/ipv6 availability to the /mirrors/status/json api.
2018-03-23 19:15:01 -04:00
jelle van der Waa
7a317b73ba
Merge pull request #85 from kyrias/json-mirror-url-active
mirrors/views/api: Add URL active status
2018-02-18 22:06:11 +01:00
Johannes Löthberg
8577d59577 mirrors/views/api: Add URL active status
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
2018-02-18 18:16:41 +01: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