refactor(devops): Migration for updating model inheritance for SoftwareEnabledFeatureFlag model
ref:#817 #812
This commit is contained in:
@ -0,0 +1,41 @@
|
||||
# Generated by Django 5.1.9 on 2025-06-11 05:39
|
||||
|
||||
import access.models.tenancy_abstract
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("access", "0016_remove_tenant_slug_alter_tenant_manager_and_more"),
|
||||
("devops", "0020_gitlabrepositoryaudithistory_and_more"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="softwareenablefeatureflag",
|
||||
name="id",
|
||||
field=models.AutoField(
|
||||
help_text="ID of the item",
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
unique=True,
|
||||
verbose_name="ID",
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="softwareenablefeatureflag",
|
||||
name="organization",
|
||||
field=models.ForeignKey(
|
||||
help_text="Tenant this belongs to",
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
related_name="+",
|
||||
to="access.tenant",
|
||||
validators=[
|
||||
access.models.tenancy_abstract.TenancyAbstractModel.validatate_organization_exists
|
||||
],
|
||||
verbose_name="Tenant",
|
||||
),
|
||||
),
|
||||
]
|
@ -200,7 +200,7 @@ CREATE TABLE IF NOT EXISTS "social_auth_nonce" ("id" integer NOT NULL PRIMARY KE
|
||||
CREATE TABLE IF NOT EXISTS "social_auth_usersocialauth" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "provider" varchar(32) NOT NULL, "uid" varchar(255) NOT NULL, "user_id" integer NOT NULL REFERENCES "auth_user" ("id") DEFERRABLE INITIALLY DEFERRED, "created" datetime NOT NULL, "modified" datetime NOT NULL, "extra_data" text NOT NULL CHECK ((JSON_VALID("extra_data") OR "extra_data" IS NULL)));
|
||||
CREATE TABLE IF NOT EXISTS "social_auth_partial" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "token" varchar(32) NOT NULL, "next_step" smallint unsigned NOT NULL CHECK ("next_step" >= 0), "backend" varchar(32) NOT NULL, "timestamp" datetime NOT NULL, "data" text NOT NULL CHECK ((JSON_VALID("data") OR "data" IS NULL)));
|
||||
DELETE FROM sqlite_sequence;
|
||||
INSERT INTO sqlite_sequence VALUES('django_migrations',197);
|
||||
INSERT INTO sqlite_sequence VALUES('django_migrations',198);
|
||||
INSERT INTO sqlite_sequence VALUES('django_content_type',179);
|
||||
INSERT INTO sqlite_sequence VALUES('auth_permission',761);
|
||||
INSERT INTO sqlite_sequence VALUES('auth_group',0);
|
||||
|
1
app/tests/fixtures/__init__.py
vendored
1
app/tests/fixtures/__init__.py
vendored
@ -140,6 +140,7 @@ from .model_software import (
|
||||
|
||||
from .model_softwareenablefeatureflag import (
|
||||
model_softwareenablefeatureflag,
|
||||
kwargs_softwareenablefeatureflag,
|
||||
)
|
||||
|
||||
from .model_team import (
|
||||
|
@ -1,3 +1,4 @@
|
||||
import datetime
|
||||
import pytest
|
||||
|
||||
from devops.models.software_enable_feature_flag import SoftwareEnableFeatureFlag
|
||||
@ -8,3 +9,35 @@ from devops.models.software_enable_feature_flag import SoftwareEnableFeatureFlag
|
||||
def model_softwareenablefeatureflag(request):
|
||||
|
||||
yield SoftwareEnableFeatureFlag
|
||||
|
||||
|
||||
@pytest.fixture( scope = 'class')
|
||||
def kwargs_softwareenablefeatureflag(django_db_blocker,
|
||||
kwargs_centurionmodel, model_software, kwargs_software
|
||||
):
|
||||
|
||||
random_str = str(datetime.datetime.now(tz=datetime.timezone.utc))
|
||||
|
||||
with django_db_blocker.unblock():
|
||||
|
||||
kwargs_soft = kwargs_software.copy()
|
||||
kwargs_soft.update({
|
||||
'name': 'seff' + str(random_str).replace(
|
||||
' ', '').replace(':', '').replace('+', '').replace('.', '')
|
||||
})
|
||||
|
||||
software = model_software.objects.create(
|
||||
**kwargs_soft
|
||||
)
|
||||
|
||||
kwargs = {
|
||||
**kwargs_centurionmodel.copy(),
|
||||
'software': software,
|
||||
'enabled': True
|
||||
}
|
||||
|
||||
yield kwargs.copy()
|
||||
|
||||
with django_db_blocker.unblock():
|
||||
|
||||
software.delete()
|
||||
|
@ -1087,6 +1087,7 @@ markers = [
|
||||
"model_knowledgebase: Selects Knowledge base tests.",
|
||||
"model_knowledgebasecategory: Selects Knowledge base category tests.",
|
||||
"model_manufacturer: Select all manufacturer tests.",
|
||||
"model_softwareenablefeatureflag: Selects tests for model Software Enabled Feature Flag.",
|
||||
"model_ticketcategory: Select all ticket category tests.",
|
||||
"model_ticketcommentcategory: Select all ticket comment category tests.",
|
||||
"models: Selects all models tests.",
|
||||
|
Reference in New Issue
Block a user