Skip to content

Commit

Permalink
feat: Add manufacture_data django command
Browse files Browse the repository at this point in the history
build: add edx-django-utils 5.10.1

docs: update docstring

feat: Add academy/curation model factories

chore: isort fix

fix: ContentMetadataFactory now generates unique content_key

feat: condense fake content_key
  • Loading branch information
marlonkeating committed Jan 24, 2024
1 parent 19e9787 commit 62b9226
Show file tree
Hide file tree
Showing 11 changed files with 65 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
"""
Management command for making instances of models with test factories.
"""

from edx_django_utils.data_generation.management.commands.manufacture_data import \
Command as BaseCommand

from enterprise_catalog.apps.academy.tests.factories import *
from enterprise_catalog.apps.catalog.tests.factories import *
from enterprise_catalog.apps.curation.tests.factories import *


class Command(BaseCommand):
"""
Management command for generating Django records from factories with custom attributes
Example usage:
$ ./manage.py manufacture_data --model enterprise_catalog.apps.catalog.models.EnterpriseCatalog /
-title "Test Catalog"
"""
2 changes: 1 addition & 1 deletion enterprise_catalog/apps/catalog/tests/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class Meta:
title = factory.Faker('lexify', text=f'{FAKE_CONTENT_TITLE_PREFIX} ??????????')

# model fields
content_key = factory.Sequence(lambda n: f'{str(n).zfill(5)}_metadata_item')
content_key = factory.Faker('bothify', text='??????????+####')
content_uuid = factory.LazyFunction(uuid4)
content_type = factory.Iterator([COURSE_RUN, COURSE, PROGRAM, LEARNER_PATHWAY])
parent_content_key = None
Expand Down
1 change: 1 addition & 0 deletions requirements/base.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ drf-spectacular
edx-auth-backends
edx-celeryutils
edx-django-release-util
edx-django-utils
edx-drf-extensions
edx_rbac
edx-rest-api-client
Expand Down
5 changes: 3 additions & 2 deletions requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,9 @@ edx-celeryutils==1.2.3
# via -r requirements/base.in
edx-django-release-util==1.3.0
# via -r requirements/base.in
edx-django-utils==5.9.0
edx-django-utils==5.10.1
# via
# -r requirements/base.in
# django-config-models
# edx-drf-extensions
# edx-rest-api-client
Expand Down Expand Up @@ -177,7 +178,7 @@ jsonfield==3.1.0
# via edx-celeryutils
jsonfield2==4.0.0.post0
# via -r requirements/base.in
jsonschema==4.20.0
jsonschema==4.21.0
# via drf-spectacular
jsonschema-specifications==2023.12.1
# via jsonschema
Expand Down
23 changes: 23 additions & 0 deletions requirements/common_constraints.txt.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# A central location for most common version constraints
# (across edx repos) for pip-installation.
#
# Similar to other constraint files this file doesn't install any packages.
# It specifies version constraints that will be applied if a package is needed.
# When pinning something here, please provide an explanation of why it is a good
# idea to pin this package across all edx repos, Ideally, link to other information
# that will help people in the future to remove the pin when possible.
# Writing an issue against the offending project and linking to it here is good.
#
# Note: Changes to this file will automatically be used by other repos, referencing
# this file from Github directly. It does not require packaging in edx-lint.


# using LTS django version


# elasticsearch>=7.14.0 includes breaking changes in it which caused issues in discovery upgrade process.
# elastic search changelog: https://www.elastic.co/guide/en/enterprise-search/master/release-notes-7.14.0.html
elasticsearch<7.14.0

# django-simple-history>3.0.0 adds indexing and causes a lot of migrations to be affected
django-simple-history==3.0.0
6 changes: 3 additions & 3 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ edx-django-release-util==1.3.0
# via
# -r requirements/quality.txt
# -r requirements/test.txt
edx-django-utils==5.9.0
edx-django-utils==5.10.1
# via
# -r requirements/quality.txt
# -r requirements/test.txt
Expand Down Expand Up @@ -394,7 +394,7 @@ jsonfield2==4.0.0.post0
# via
# -r requirements/quality.txt
# -r requirements/test.txt
jsonschema==4.20.0
jsonschema==4.21.0
# via
# -r requirements/quality.txt
# -r requirements/test.txt
Expand Down Expand Up @@ -726,7 +726,7 @@ tomlkit==0.12.3
# -r requirements/quality.txt
# -r requirements/test.txt
# pylint
tox==4.12.0
tox==4.12.1
# via -r requirements/test.txt
typing-extensions==4.9.0
# via
Expand Down
8 changes: 4 additions & 4 deletions requirements/doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ backports-zoneinfo[tzdata]==0.2.1
# celery
# django
# kombu
beautifulsoup4==4.12.2
beautifulsoup4==4.12.3
# via pydata-sphinx-theme
billiard==4.2.0
# via
Expand Down Expand Up @@ -235,7 +235,7 @@ edx-celeryutils==1.2.3
# via -r requirements/test.txt
edx-django-release-util==1.3.0
# via -r requirements/test.txt
edx-django-utils==5.9.0
edx-django-utils==5.10.1
# via
# -r requirements/test.txt
# django-config-models
Expand Down Expand Up @@ -311,7 +311,7 @@ jsonfield==3.1.0
# edx-celeryutils
jsonfield2==4.0.0.post0
# via -r requirements/test.txt
jsonschema==4.20.0
jsonschema==4.21.0
# via
# -r requirements/test.txt
# drf-spectacular
Expand Down Expand Up @@ -600,7 +600,7 @@ tomlkit==0.12.3
# via
# -r requirements/test.txt
# pylint
tox==4.12.0
tox==4.12.1
# via -r requirements/test.txt
typing-extensions==4.9.0
# via
Expand Down
4 changes: 2 additions & 2 deletions requirements/production.txt
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ edx-celeryutils==1.2.3
# via -r requirements/base.txt
edx-django-release-util==1.3.0
# via -r requirements/base.txt
edx-django-utils==5.9.0
edx-django-utils==5.10.1
# via
# -r requirements/base.txt
# django-config-models
Expand Down Expand Up @@ -220,7 +220,7 @@ jsonfield==3.1.0
# edx-celeryutils
jsonfield2==4.0.0.post0
# via -r requirements/base.txt
jsonschema==4.20.0
jsonschema==4.21.0
# via
# -r requirements/base.txt
# drf-spectacular
Expand Down
4 changes: 2 additions & 2 deletions requirements/quality.txt
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ edx-celeryutils==1.2.3
# via -r requirements/base.txt
edx-django-release-util==1.3.0
# via -r requirements/base.txt
edx-django-utils==5.9.0
edx-django-utils==5.10.1
# via
# -r requirements/base.txt
# django-config-models
Expand Down Expand Up @@ -238,7 +238,7 @@ jsonfield==3.1.0
# edx-celeryutils
jsonfield2==4.0.0.post0
# via -r requirements/base.txt
jsonschema==4.20.0
jsonschema==4.21.0
# via
# -r requirements/base.txt
# drf-spectacular
Expand Down
6 changes: 3 additions & 3 deletions requirements/test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ edx-celeryutils==1.2.3
# via -r requirements/base.txt
edx-django-release-util==1.3.0
# via -r requirements/base.txt
edx-django-utils==5.9.0
edx-django-utils==5.10.1
# via
# -r requirements/base.txt
# django-config-models
Expand Down Expand Up @@ -264,7 +264,7 @@ jsonfield==3.1.0
# edx-celeryutils
jsonfield2==4.0.0.post0
# via -r requirements/base.txt
jsonschema==4.20.0
jsonschema==4.21.0
# via
# -r requirements/base.txt
# drf-spectacular
Expand Down Expand Up @@ -490,7 +490,7 @@ tomli==2.0.1
# tox
tomlkit==0.12.3
# via pylint
tox==4.12.0
tox==4.12.1
# via -r requirements/test.in
typing-extensions==4.9.0
# via
Expand Down
6 changes: 3 additions & 3 deletions requirements/validation.txt
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ edx-django-release-util==1.3.0
# via
# -r requirements/quality.txt
# -r requirements/test.txt
edx-django-utils==5.9.0
edx-django-utils==5.10.1
# via
# -r requirements/quality.txt
# -r requirements/test.txt
Expand Down Expand Up @@ -360,7 +360,7 @@ jsonfield2==4.0.0.post0
# via
# -r requirements/quality.txt
# -r requirements/test.txt
jsonschema==4.20.0
jsonschema==4.21.0
# via
# -r requirements/quality.txt
# -r requirements/test.txt
Expand Down Expand Up @@ -664,7 +664,7 @@ tomlkit==0.12.3
# -r requirements/quality.txt
# -r requirements/test.txt
# pylint
tox==4.12.0
tox==4.12.1
# via -r requirements/test.txt
typing-extensions==4.9.0
# via
Expand Down

0 comments on commit 62b9226

Please sign in to comment.