Skip to content

Commit

Permalink
Merge branch 'master' into pyup-update-sphinx-3.2.1-to-3.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
willemarcel committed Nov 5, 2020
2 parents cc3547f + 2521202 commit b3f013e
Show file tree
Hide file tree
Showing 8 changed files with 89 additions and 43 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/django.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Django CI

on:
[pull_request, pull_request_target]

jobs:
build:
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: [3.6, 3.7, 3.8]

steps:
- uses: actions/checkout@v2
- name: Setup PostgreSQL with Postgis
uses: huaxk/postgis-action@v1.0.0
with:
postgresql version: latest
postgresql db: osmcha
postgresql user: ${{ secrets.POSTGRES_USER }}
postgresql password: ${{ secrets.POSTGRES_PASSWORD }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
run: |
sudo apt-get install -y binutils libproj-dev python3-gdal libgeos-dev libyaml-dev
python -m pip install --upgrade pip
pip install --upgrade coveralls
pip install -r requirements/test.txt
- name: Run Tests
run: |
coverage run manage.py test --settings=config.settings.tests
env:
OAUTH_OSM_KEY: ${{ secrets.OAUTH_OSM_KEY }}
OAUTH_OSM_SECRET: ${{ secrets.OAUTH_OSM_SECRET }}
POSTGRES_USER: ${{ secrets.POSTGRES_USER }}
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
- name: Upload Coverage
run: coveralls
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: ${{ matrix.test-name }}
COVERALLS_PARALLEL: true

coveralls:
name: Finish Coveralls
needs: build
runs-on: ubuntu-latest
container: python:3-slim
steps:
- name: Finished
run: |
pip install --upgrade coveralls
coveralls --finish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38 changes: 0 additions & 38 deletions .travis.yml

This file was deleted.

18 changes: 18 additions & 0 deletions osmchadjango/changeset/migrations/0053_auto_20201105_1229.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 2.2.13 on 2020-11-05 12:29

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('changeset', '0052_changeset_comments_count'),
]

operations = [
migrations.AlterField(
model_name='changeset',
name='comments_count',
field=models.IntegerField(db_index=True, default=0, null=True),
),
]
2 changes: 1 addition & 1 deletion osmchadjango/changeset/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class Changeset(models.Model):
editor = models.CharField(max_length=255, blank=True, null=True, db_index=True)
powerfull_editor = models.BooleanField(_('Powerfull Editor'), default=False)
comment = models.CharField(max_length=1000, blank=True, null=True, db_index=True)
comments_count = models.IntegerField(null=True, db_index=True)
comments_count = models.IntegerField(null=True, db_index=True, default=0)
source = models.CharField(max_length=1000, blank=True, null=True, db_index=True)
imagery_used = models.CharField(max_length=1000, blank=True, null=True, db_index=True)
date = models.DateTimeField(null=True, db_index=True)
Expand Down
6 changes: 6 additions & 0 deletions osmchadjango/changeset/tests/test_whitelist_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ def setUp(self):
uid='123123',
)
UserWhitelist.objects.create(user=self.user, whitelist_user='good_user')
UserWhitelist.objects.create(user=self.user, whitelist_user='good user#23 %7á')
self.user_2 = User.objects.create_user(
username='test_user',
password='password',
Expand Down Expand Up @@ -116,6 +117,11 @@ def test_delete_userwhitelist(self):
reverse('changeset:delete-whitelist-user', args=['good_user'])
)
self.assertEqual(response.status_code, 204)
# test username with blankspaces and special chars
response = self.client.delete(
reverse('changeset:delete-whitelist-user', args=['good user#23 %7á'])
)
self.assertEqual(response.status_code, 204)
# test delete a whitelist of another user
response = self.client.delete(
reverse('changeset:delete-whitelist-user', args=['the_user'])
Expand Down
6 changes: 3 additions & 3 deletions osmchadjango/changeset/urls.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals

from django.urls import re_path
from django.urls import re_path, path

from . import views

Expand Down Expand Up @@ -91,8 +91,8 @@
view=views.UserWhitelistListCreateAPIView.as_view(),
name='whitelist-user'
),
re_path(
r'^whitelist-user/(?P<whitelist_user>\w+)/$',
path(
'whitelist-user/<str:whitelist_user>/',
view=views.UserWhitelistDestroyAPIView.as_view(),
name='delete-whitelist-user'
),
Expand Down
2 changes: 1 addition & 1 deletion requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ unicode-slugify==0.1.3
django-autoslug==1.9.8

# Time zones support
pytz==2020.1
pytz==2020.4

# Celery support
celery==3.1.25
Expand Down
1 change: 1 addition & 0 deletions requirements/test.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Test dependencies go here.
-r base.txt
flake8==3.8.4
coverage==5.3
django-test-plus==1.4.0
factory-boy==3.1.0

0 comments on commit b3f013e

Please sign in to comment.