Skip to content

Commit

Permalink
Merge branch 'django-4.2' of 'https://github.com/jjmerchante/grimoire…
Browse files Browse the repository at this point in the history
…lab-sortinghat'

Merges #879
Closes #879
  • Loading branch information
sduenas committed Apr 12, 2024
2 parents cc91c50 + 5bd36d1 commit e4263cd
Show file tree
Hide file tree
Showing 13 changed files with 82 additions and 35 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ jobs:
run: |
PACKAGE=`(cd dist && ls *whl)` && echo $PACKAGE
poetry run pip install --pre ./dist/$PACKAGE
poetry run python manage.py test --settings=config.settings.testing
poetry run python manage.py test --settings=config.settings.testing_tenant
poetry run python manage.py test --settings=config.settings.config_testing
poetry run python manage.py test --settings=config.settings.config_testing_tenant
release:
needs: [tests]
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ jobs:
poetry run flake8
- name: Tests
run: |
poetry run python manage.py test --settings=config.settings.testing
poetry run python manage.py test --settings=config.settings.testing_tenant
poetry run python manage.py test --settings=config.settings.config_testing
poetry run python manage.py test --settings=config.settings.config_testing_tenant
frontend:

Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ In the context of GrimoireLab, Sorting Hat is usually run after data is retrieve
* Python >= 3.8
* Poetry >= 1.1.0
* MySQL >= 5.7 or MariaDB 10.0
* Django = 3.2
* Django = 4.2
* Graphene-Django >= 2.0
* uWSGI >= 2.0

Expand Down Expand Up @@ -70,7 +70,7 @@ $ apt install libmariadbclient-dev-compat
**Note**: these examples use `sortinghat.config.settings` configuration file.
In order to use that configuration you need to define the environment variable
`SORTINGHAT_SECRET_KEY` with a secret. More info here:
https://docs.djangoproject.com/en/3.2/ref/settings/#std:setting-SECRET_KEY
https://docs.djangoproject.com/en/4.2/ref/settings/#std:setting-SECRET_KEY


Install the required dependencies (this will also create a virtual environment).
Expand Down Expand Up @@ -285,8 +285,8 @@ frontend and backend.

#### Backend test suite
```
(.venv)$ ./manage.py test --settings=config.settings.testing
(.venv)$ ./manage.py test --settings=config.settings.testing_tenant
(.venv)$ ./manage.py test --settings=config.settings.config_testing
(.venv)$ ./manage.py test --settings=config.settings.config_testing_tenant
```

#### Frontend test suite
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from .testing import * # noqa: F403,F401
from .testing import SQL_MODE, DATABASES, RQ_QUEUES
from .config_testing import * # noqa: F403,F401
from .config_testing import SQL_MODE, DATABASES, RQ_QUEUES

tenants_cfg = [
{'name': 'tenant_1', 'dedicated_queue': True},
Expand Down
60 changes: 50 additions & 10 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ sortinghat-admin = "sortinghat.server.sortinghat_admin:sortinghat_admin"
python = "^3.8"

click = "7.1.1"
Django = "^3.2"
Django = "^4.2"
django-graphql-jwt = "^0.3.0"
graphene-django = "^2.15"
sgqlc = "^16.1"
Expand Down
10 changes: 10 additions & 0 deletions releases/unreleased/django-version-updated.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: Django version updated
category: dependency
author: Jose Javier Merchante <jjmerchante@bitergia.com>
issue: null
notes: >
Upgrade the Django version from 3.2 to 4.2. Support for
Django 3.2 ended at April 1, 2024. This change ensures
compability with the latests features and an extended
support.
3 changes: 1 addition & 2 deletions sortinghat/config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@
#
# Static files (CSS, JavaScript, Images)
#
# https://docs.djangoproject.com/en/3.2/howto/static-files/
# https://docs.djangoproject.com/en/4.2/howto/static-files/
#

STATIC_URL = '/'
Expand Down Expand Up @@ -209,7 +209,6 @@

LANGUAGE_CODE = 'en-us'
USE_I18N = True
USE_L10N = True

#
# Time Zone
Expand Down
5 changes: 2 additions & 3 deletions sortinghat/core/migrations/0001_sortinghat.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import datetime
from django.db import migrations, models
import django.db.models.deletion
from django.utils.timezone import utc
import grimoirelab_toolkit.datetime
import sortinghat.core.models

Expand Down Expand Up @@ -210,8 +209,8 @@ class Migration(migrations.Migration):
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created_at', sortinghat.core.models.CreationDateTimeField(default=grimoirelab_toolkit.datetime.datetime_utcnow, editable=False)),
('last_modified', sortinghat.core.models.LastModificationDateTimeField(default=grimoirelab_toolkit.datetime.datetime_utcnow, editable=False)),
('start', models.DateTimeField(default=datetime.datetime(1900, 1, 1, 0, 0, tzinfo=utc))),
('end', models.DateTimeField(default=datetime.datetime(2100, 1, 1, 0, 0, tzinfo=utc))),
('start', models.DateTimeField(default=datetime.datetime(1900, 1, 1, 0, 0, tzinfo=datetime.timezone.utc))),
('end', models.DateTimeField(default=datetime.datetime(2100, 1, 1, 0, 0, tzinfo=datetime.timezone.utc))),
('group', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='enrollments', to='core.group')),
('individual', models.ForeignKey(db_column='mk', on_delete=django.db.models.deletion.CASCADE, related_name='enrollments', to='core.individual')),
],
Expand Down
12 changes: 6 additions & 6 deletions sortinghat/core/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -1100,7 +1100,7 @@ class Arguments:

job_id = graphene.Field(lambda: graphene.String)

@check_permissions('core.execute_job')
@check_permissions(['core.execute_job'])
@check_auth
def mutate(self, info, uuids=None, last_modified=MIN_PERIOD_DATE):
user = info.context.user
Expand Down Expand Up @@ -1131,7 +1131,7 @@ class Arguments:

job_id = graphene.Field(lambda: graphene.String)

@check_permissions('core.execute_job')
@check_permissions(['core.execute_job'])
@check_auth
def mutate(self, info, criteria,
source_uuids=None, target_uuids=None,
Expand Down Expand Up @@ -1166,7 +1166,7 @@ class Arguments:

job_id = graphene.Field(lambda: graphene.String)

@check_permissions('core.execute_job')
@check_permissions(['core.execute_job'])
@check_auth
def mutate(self, info, uuids=None, exclude=True, no_strict_matching=False):
user = info.context.user
Expand All @@ -1191,7 +1191,7 @@ class Arguments:

job_id = graphene.Field(lambda: graphene.String)

@check_permissions('core.execute_job')
@check_permissions(['core.execute_job'])
@check_auth
def mutate(self, info, uuids=None, last_modified=MIN_PERIOD_DATE):
user = info.context.user
Expand Down Expand Up @@ -1221,7 +1221,7 @@ class Arguments:

job_id = graphene.Field(lambda: graphene.String)

@check_permissions('core.execute_job')
@check_permissions(['core.execute_job'])
@check_auth
def mutate(self, info, criteria,
source_uuids=None, target_uuids=None,
Expand Down Expand Up @@ -1256,7 +1256,7 @@ class Arguments:

job_id = graphene.Field(lambda: graphene.String)

@check_permissions('core.execute_job')
@check_permissions(['core.execute_job'])
@check_auth
def mutate(self, info, uuids=None, exclude=True, no_strict_matching=False):
user = info.context.user
Expand Down
2 changes: 1 addition & 1 deletion tests/tenants/test_jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def test_default_tenant_queue(self):
def test_not_found_queue(self):
"""Check it an error is raised when the queue is not found"""

# The configuration in settings.testing_tenant ignores
# The configuration in settings.config_testing_tenant ignores
# the creation of this queue, so it should raise an error.
with self.assertRaisesRegex(JobError, "Queue 'error_tenant' not found."):
jobs.get_tenant_queue('error_tenant')
3 changes: 1 addition & 2 deletions tests/test_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@
" for Example not found in the registry"
PAGINATION_NO_RESULTS_ERROR = "That page contains no results"
PAGINATION_PAGE_LESS_THAN_ONE_ERROR = "That page number is less than 1"
PAGINATION_PAGE_SIZE_NEGATIVE_ERROR = "Negative indexing is not supported."
PAGINATION_PAGE_SIZE_ZERO_ERROR = "division by zero"
AUTHENTICATION_ERROR = "You do not have permission to perform this action"
PARSE_DATE_INVALID_DATE_ERROR = "{} is not a valid date"
Expand Down Expand Up @@ -1418,7 +1417,7 @@ def test_page_size_negative(self):
context_value=self.context_value)

msg = executed['errors'][0]['message']
self.assertEqual(msg, PAGINATION_PAGE_SIZE_NEGATIVE_ERROR)
self.assertEqual(msg, PAGINATION_NO_RESULTS_ERROR)

def test_page_size_zero(self):
"""Check if it fails when `pageSize` is set to `0`"""
Expand Down

0 comments on commit e4263cd

Please sign in to comment.