Skip to content

Commit

Permalink
Make tests runnable via runserver
Browse files Browse the repository at this point in the history
  • Loading branch information
akx committed Apr 9, 2024
1 parent 000a6bb commit 675ccf2
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 0 deletions.
60 changes: 60 additions & 0 deletions tests/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Generated by Django 5.0.4 on 2024-04-09 06:18

from django.db import migrations, models

import enumfields.fields
import tests.enums


class Migration(migrations.Migration):
initial = True

dependencies = []

operations = [
migrations.CreateModel(
name="MyModel",
fields=[
("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
("color", enumfields.fields.EnumField(enum=tests.enums.Color, max_length=1)),
(
"color_not_editable",
enumfields.fields.EnumField(editable=False, enum=tests.enums.Color, max_length=1, null=True),
),
("taste", enumfields.fields.EnumField(default=1, enum=tests.enums.Taste, max_length=10)),
(
"taste_not_editable",
enumfields.fields.EnumField(default=1, editable=False, enum=tests.enums.Taste, max_length=10),
),
(
"taste_null_default",
enumfields.fields.EnumField(
blank=True, default=None, enum=tests.enums.Taste, max_length=10, null=True
),
),
("taste_int", enumfields.fields.EnumIntegerField(default=1, enum=tests.enums.Taste)),
(
"default_none",
enumfields.fields.EnumIntegerField(blank=True, default=None, enum=tests.enums.Taste, null=True),
),
("nullable", enumfields.fields.EnumIntegerField(blank=True, enum=tests.enums.Taste, null=True)),
("random_code", models.TextField(blank=True, null=True)),
("zero", enumfields.fields.EnumIntegerField(default=0, enum=tests.enums.ZeroEnum)),
("zero2", enumfields.fields.EnumIntegerField(blank=True, default=0, enum=tests.enums.ZeroEnum)),
(
"int_enum",
enumfields.fields.EnumIntegerField(
blank=True, default=None, enum=tests.enums.IntegerEnum, null=True
),
),
(
"int_enum_not_editable",
enumfields.fields.EnumIntegerField(default=0, editable=False, enum=tests.enums.IntegerEnum),
),
(
"labeled_enum",
enumfields.fields.EnumField(blank=True, enum=tests.enums.LabeledEnum, max_length=10, null=True),
),
],
),
]
Empty file added tests/migrations/__init__.py
Empty file.
4 changes: 4 additions & 0 deletions tests/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
'django.contrib.sessions',
'django.contrib.auth',
'django.contrib.admin',
'django.contrib.messages',
'tests',
)

Expand Down Expand Up @@ -42,9 +43,12 @@
'django.template.context_processors.i18n',
'django.template.context_processors.media',
'django.template.context_processors.static',
'django.template.context_processors.request',
'django.template.context_processors.tz',
'django.contrib.messages.context_processors.messages',
],
},
},
]

DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'

0 comments on commit 675ccf2

Please sign in to comment.