From 88cb0801c62fe821505b8c5184dd722082fddc17 Mon Sep 17 00:00:00 2001 From: Gagan Deep Date: Thu, 23 Nov 2023 22:18:38 +0530 Subject: [PATCH] [chores] Added celery configuration --- tests/openwisp2/__init__.py | 3 +++ tests/openwisp2/celery.py | 9 +++++++++ .../sample_users/migrations/0001_initial.py | 6 ++++++ .../migrations/0003_user_password_updated.py | 20 ------------------- tests/openwisp2/settings.py | 2 ++ 5 files changed, 20 insertions(+), 20 deletions(-) create mode 100644 tests/openwisp2/celery.py delete mode 100644 tests/openwisp2/sample_users/migrations/0003_user_password_updated.py diff --git a/tests/openwisp2/__init__.py b/tests/openwisp2/__init__.py index e69de29..cd04264 100644 --- a/tests/openwisp2/__init__.py +++ b/tests/openwisp2/__init__.py @@ -0,0 +1,3 @@ +from .celery import app as celery_app + +__all__ = ['celery_app'] diff --git a/tests/openwisp2/celery.py b/tests/openwisp2/celery.py new file mode 100644 index 0000000..e3c1425 --- /dev/null +++ b/tests/openwisp2/celery.py @@ -0,0 +1,9 @@ +import os + +from celery import Celery + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'openwisp2.settings') + +app = Celery('openwisp2') +app.config_from_object('django.conf:settings', namespace='CELERY') +app.autodiscover_tasks() diff --git a/tests/openwisp2/sample_users/migrations/0001_initial.py b/tests/openwisp2/sample_users/migrations/0001_initial.py index 28817d2..d20993c 100644 --- a/tests/openwisp2/sample_users/migrations/0001_initial.py +++ b/tests/openwisp2/sample_users/migrations/0001_initial.py @@ -188,6 +188,12 @@ class Migration(migrations.Migration): max_length=8, ), ), + ( + 'password_updated', + models.DateField( + blank=True, null=True, verbose_name="password updated" + ), + ), ], options={ 'verbose_name': 'user', diff --git a/tests/openwisp2/sample_users/migrations/0003_user_password_updated.py b/tests/openwisp2/sample_users/migrations/0003_user_password_updated.py deleted file mode 100644 index 4fa1137..0000000 --- a/tests/openwisp2/sample_users/migrations/0003_user_password_updated.py +++ /dev/null @@ -1,20 +0,0 @@ -# Generated by Django 4.2.4 on 2023-11-23 16:15 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ("sample_users", "0002_default_groups_and_permissions"), - ] - - operations = [ - migrations.AddField( - model_name="user", - name="password_updated", - field=models.DateField( - blank=True, null=True, verbose_name="password updated" - ), - ), - ] diff --git a/tests/openwisp2/settings.py b/tests/openwisp2/settings.py index 9afd06d..d445abb 100644 --- a/tests/openwisp2/settings.py +++ b/tests/openwisp2/settings.py @@ -88,6 +88,8 @@ EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' OPENWISP_USERS_AUTH_API = True +CELERY_BROKER_URL = 'memory://' + if TESTING: OPENWISP_ORGANIZATION_USER_ADMIN = True OPENWISP_ORGANIZATION_OWNER_ADMIN = True