@ -16,7 +16,6 @@ CREATE TABLE IF NOT EXISTS "project_management_projectstate" ("is_global" bool N
|
||||
CREATE TABLE IF NOT EXISTS "project_management_projecttype" ("is_global" bool NOT NULL, "model_notes" text NULL, "id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "created" datetime NOT NULL, "modified" datetime NOT NULL, "name" varchar(50) NOT NULL UNIQUE, "runbook_id" integer NULL REFERENCES "assistance_knowledgebase" ("id") DEFERRABLE INITIALLY DEFERRED, "organization_id" integer NOT NULL REFERENCES "access_tenant" ("id") DEFERRABLE INITIALLY DEFERRED);
|
||||
CREATE TABLE IF NOT EXISTS "itim_service_dependent_service" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "from_service_id" integer NOT NULL REFERENCES "itim_service" ("id") DEFERRABLE INITIALLY DEFERRED, "to_service_id" integer NOT NULL REFERENCES "itim_service" ("id") DEFERRABLE INITIALLY DEFERRED);
|
||||
CREATE TABLE IF NOT EXISTS "itim_service_port" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "service_id" integer NOT NULL REFERENCES "itim_service" ("id") DEFERRABLE INITIALLY DEFERRED, "port_id" integer NOT NULL REFERENCES "itim_port" ("id") DEFERRABLE INITIALLY DEFERRED);
|
||||
CREATE TABLE IF NOT EXISTS "itim_port" ("is_global" bool NOT NULL, "model_notes" text NULL, "id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "number" integer NOT NULL, "description" varchar(80) NULL, "created" datetime NOT NULL, "modified" datetime NOT NULL, "organization_id" integer NOT NULL REFERENCES "access_tenant" ("id") DEFERRABLE INITIALLY DEFERRED, "protocol" varchar(3) NOT NULL);
|
||||
CREATE TABLE IF NOT EXISTS "itim_service" ("is_global" bool NOT NULL, "model_notes" text NULL, "id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "is_template" bool NOT NULL, "name" varchar(50) NOT NULL, "config" text NULL CHECK ((JSON_VALID("config") OR "config" IS NULL)), "config_key_variable" varchar(50) NULL, "created" datetime NOT NULL, "modified" datetime NOT NULL, "cluster_id" integer NULL REFERENCES "itim_cluster" ("id") DEFERRABLE INITIALLY DEFERRED, "device_id" integer NULL REFERENCES "itam_device" ("id") DEFERRABLE INITIALLY DEFERRED, "organization_id" integer NOT NULL REFERENCES "access_tenant" ("id") DEFERRABLE INITIALLY DEFERRED, "template_id" integer NULL REFERENCES "itim_service" ("id") DEFERRABLE INITIALLY DEFERRED);
|
||||
CREATE TABLE IF NOT EXISTS "core_ticket_assigned_teams" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "ticket_id" integer NOT NULL REFERENCES "core_ticket" ("id") DEFERRABLE INITIALLY DEFERRED, "team_id" integer NOT NULL REFERENCES "access_team" ("group_ptr_id") DEFERRABLE INITIALLY DEFERRED);
|
||||
CREATE TABLE IF NOT EXISTS "core_ticket_assigned_users" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "ticket_id" integer NOT NULL REFERENCES "core_ticket" ("id") DEFERRABLE INITIALLY DEFERRED, "user_id" integer NOT NULL REFERENCES "auth_user" ("id") DEFERRABLE INITIALLY DEFERRED);
|
||||
@ -207,6 +206,9 @@ CREATE TABLE IF NOT EXISTS "itim_cluster_centurionmodelnote" ("centurionmodelnot
|
||||
CREATE TABLE IF NOT EXISTS "itim_clustertype" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "name" varchar(50) NOT NULL, "organization_id" integer NOT NULL REFERENCES "access_tenant" ("id") DEFERRABLE INITIALLY DEFERRED, "created" datetime NOT NULL, "modified" datetime NOT NULL, "config" text NULL CHECK ((JSON_VALID("config") OR "config" IS NULL)), "model_notes" text NULL);
|
||||
CREATE TABLE IF NOT EXISTS "itim_clustertype_audithistory" ("centurionaudit_ptr_id" integer NOT NULL PRIMARY KEY REFERENCES "core_audithistory" ("id") DEFERRABLE INITIALLY DEFERRED, "model_id" integer NOT NULL REFERENCES "itim_clustertype" ("id") DEFERRABLE INITIALLY DEFERRED);
|
||||
CREATE TABLE IF NOT EXISTS "itim_clustertype_centurionmodelnote" ("centurionmodelnote_ptr_id" integer NOT NULL PRIMARY KEY REFERENCES "core_centurionmodelnote" ("id") DEFERRABLE INITIALLY DEFERRED, "model_id" integer NOT NULL REFERENCES "itim_clustertype" ("id") DEFERRABLE INITIALLY DEFERRED);
|
||||
CREATE TABLE IF NOT EXISTS "itim_port" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "number" integer NOT NULL, "description" varchar(80) NULL, "protocol" varchar(3) NOT NULL, "created" datetime NOT NULL, "modified" datetime NOT NULL, "organization_id" integer NOT NULL REFERENCES "access_tenant" ("id") DEFERRABLE INITIALLY DEFERRED, "model_notes" text NULL);
|
||||
CREATE TABLE IF NOT EXISTS "itim_port_audithistory" ("centurionaudit_ptr_id" integer NOT NULL PRIMARY KEY REFERENCES "core_audithistory" ("id") DEFERRABLE INITIALLY DEFERRED, "model_id" integer NOT NULL REFERENCES "itim_port" ("id") DEFERRABLE INITIALLY DEFERRED);
|
||||
CREATE TABLE IF NOT EXISTS "itim_port_centurionmodelnote" ("centurionmodelnote_ptr_id" integer NOT NULL PRIMARY KEY REFERENCES "core_centurionmodelnote" ("id") DEFERRABLE INITIALLY DEFERRED, "model_id" integer NOT NULL REFERENCES "itim_port" ("id") DEFERRABLE INITIALLY DEFERRED);
|
||||
CREATE TABLE IF NOT EXISTS "django_session" ("session_key" varchar(40) NOT NULL PRIMARY KEY, "session_data" text NOT NULL, "expire_date" datetime NOT NULL);
|
||||
CREATE TABLE IF NOT EXISTS "social_auth_association" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "server_url" varchar(255) NOT NULL, "handle" varchar(255) NOT NULL, "secret" varchar(255) NOT NULL, "issued" integer NOT NULL, "lifetime" integer NOT NULL, "assoc_type" varchar(64) NOT NULL);
|
||||
CREATE TABLE IF NOT EXISTS "social_auth_code" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "email" varchar(254) NOT NULL, "code" varchar(32) NOT NULL, "verified" bool NOT NULL, "timestamp" datetime NOT NULL);
|
||||
@ -214,16 +216,15 @@ 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',208);
|
||||
INSERT INTO sqlite_sequence VALUES('django_content_type',193);
|
||||
INSERT INTO sqlite_sequence VALUES('auth_permission',817);
|
||||
INSERT INTO sqlite_sequence VALUES('django_migrations',209);
|
||||
INSERT INTO sqlite_sequence VALUES('django_content_type',195);
|
||||
INSERT INTO sqlite_sequence VALUES('auth_permission',825);
|
||||
INSERT INTO sqlite_sequence VALUES('auth_group',0);
|
||||
INSERT INTO sqlite_sequence VALUES('auth_user',0);
|
||||
INSERT INTO sqlite_sequence VALUES('project_management_project',0);
|
||||
INSERT INTO sqlite_sequence VALUES('project_management_projectmilestone',0);
|
||||
INSERT INTO sqlite_sequence VALUES('project_management_projectstate',0);
|
||||
INSERT INTO sqlite_sequence VALUES('project_management_projecttype',0);
|
||||
INSERT INTO sqlite_sequence VALUES('itim_port',0);
|
||||
INSERT INTO sqlite_sequence VALUES('itim_service',0);
|
||||
INSERT INTO sqlite_sequence VALUES('core_notes',0);
|
||||
INSERT INTO sqlite_sequence VALUES('core_relatedtickets',0);
|
||||
@ -270,6 +271,7 @@ INSERT INTO sqlite_sequence VALUES('itim_cluster_devices',0);
|
||||
INSERT INTO sqlite_sequence VALUES('itim_cluster_nodes',0);
|
||||
INSERT INTO sqlite_sequence VALUES('itim_cluster',0);
|
||||
INSERT INTO sqlite_sequence VALUES('itim_clustertype',0);
|
||||
INSERT INTO sqlite_sequence VALUES('itim_port',0);
|
||||
INSERT INTO sqlite_sequence VALUES('social_auth_association',0);
|
||||
INSERT INTO sqlite_sequence VALUES('social_auth_code',0);
|
||||
INSERT INTO sqlite_sequence VALUES('social_auth_nonce',0);
|
||||
|
@ -83,16 +83,6 @@ class ClusterModelTestCases(
|
||||
}
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="to be written")
|
||||
def test_cluster_move_organization(user):
|
||||
"""Move Organization test
|
||||
|
||||
When a cluster moves organization, clustersoftware and clustersoftware table data
|
||||
must also move organizations
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
|
||||
class ClusterModelInheritedCases(
|
||||
ClusterModelTestCases,
|
||||
|
19
app/itim/tests/unit/port/conftest.py
Normal file
19
app/itim/tests/unit/port/conftest.py
Normal file
@ -0,0 +1,19 @@
|
||||
import pytest
|
||||
|
||||
|
||||
|
||||
@pytest.fixture( scope = 'class')
|
||||
def model(model_port):
|
||||
|
||||
yield model_port
|
||||
|
||||
|
||||
@pytest.fixture( scope = 'class', autouse = True)
|
||||
def model_kwargs(request, kwargs_port):
|
||||
|
||||
request.cls.kwargs_create_item = kwargs_port.copy()
|
||||
|
||||
yield kwargs_port.copy()
|
||||
|
||||
if hasattr(request.cls, 'kwargs_create_item'):
|
||||
del request.cls.kwargs_create_item
|
@ -1,5 +1,4 @@
|
||||
import pytest
|
||||
import unittest
|
||||
|
||||
from django.contrib.auth.models import Permission, User
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
@ -18,6 +17,8 @@ from itim.models.services import Port
|
||||
|
||||
|
||||
|
||||
@pytest.mark.model_port
|
||||
@pytest.mark.module_itim
|
||||
class PortAPI(
|
||||
TestCase,
|
||||
APITenancyObject
|
||||
|
@ -1,31 +1,77 @@
|
||||
import pytest
|
||||
|
||||
from django.test import TestCase
|
||||
from django.db import models
|
||||
|
||||
from centurion.tests.unit.test_unit_models import (
|
||||
TenancyObjectInheritedCases
|
||||
|
||||
from core.tests.unit.centurion_abstract.test_unit_centurion_abstract_model import (
|
||||
CenturionAbstractModelInheritedCases
|
||||
)
|
||||
|
||||
from itim.models.services import Port
|
||||
|
||||
|
||||
|
||||
class PortModel(
|
||||
TenancyObjectInheritedCases,
|
||||
TestCase,
|
||||
@pytest.mark.model_port
|
||||
class PortModelTestCases(
|
||||
CenturionAbstractModelInheritedCases
|
||||
):
|
||||
|
||||
kwargs_item_create = {
|
||||
'number': 1,
|
||||
|
||||
@property
|
||||
def parameterized_class_attributes(self):
|
||||
|
||||
return {
|
||||
'model_tag': {
|
||||
'type': str,
|
||||
'value': 'port'
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@property
|
||||
def parameterized_model_fields(self):
|
||||
|
||||
return {
|
||||
'number': {
|
||||
'blank': False,
|
||||
'default': models.fields.NOT_PROVIDED,
|
||||
'field_type': models.IntegerField,
|
||||
'null': False,
|
||||
'unique': False,
|
||||
},
|
||||
'description': {
|
||||
'blank': True,
|
||||
'default': models.fields.NOT_PROVIDED,
|
||||
'field_type': models.CharField,
|
||||
'length': 80,
|
||||
'null': True,
|
||||
'unique': False,
|
||||
},
|
||||
'protocol': {
|
||||
'blank': False,
|
||||
'default': models.fields.NOT_PROVIDED,
|
||||
'field_type': models.CharField,
|
||||
'null': False,
|
||||
'unique': False,
|
||||
},
|
||||
'modified': {
|
||||
'blank': False,
|
||||
'default': models.fields.NOT_PROVIDED,
|
||||
'field_type': models.DateTimeField,
|
||||
'null': False,
|
||||
'unique': False,
|
||||
},
|
||||
}
|
||||
|
||||
model = Port
|
||||
|
||||
|
||||
@pytest.mark.skip(reason = 'to be written')
|
||||
def test_field_entry_invalid_port_to_high(self):
|
||||
"""Test Model Field
|
||||
class PortModelInheritedCases(
|
||||
PortModelTestCases,
|
||||
):
|
||||
pass
|
||||
|
||||
Ensure that a validation error is thrown and that is displays to the user
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
@pytest.mark.module_itim
|
||||
class PortModelPyTest(
|
||||
PortModelTestCases,
|
||||
):
|
||||
pass
|
||||
|
@ -1,3 +1,5 @@
|
||||
import pytest
|
||||
|
||||
from django.test import Client, TestCase
|
||||
|
||||
from rest_framework.reverse import reverse
|
||||
@ -8,6 +10,8 @@ from itim.viewsets.port import ViewSet
|
||||
|
||||
|
||||
|
||||
@pytest.mark.model_port
|
||||
@pytest.mark.module_itim
|
||||
class PortViewsetList(
|
||||
ModelViewSetInheritedCases,
|
||||
TestCase,
|
||||
|
5
app/tests/fixtures/__init__.py
vendored
5
app/tests/fixtures/__init__.py
vendored
@ -163,6 +163,11 @@ from .model_permission import (
|
||||
model_permission,
|
||||
)
|
||||
|
||||
from .model_port import (
|
||||
kwargs_port,
|
||||
model_port,
|
||||
)
|
||||
|
||||
from .model_software import (
|
||||
kwargs_software,
|
||||
model_software,
|
||||
|
26
app/tests/fixtures/model_port.py
vendored
Normal file
26
app/tests/fixtures/model_port.py
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
import datetime
|
||||
import pytest
|
||||
import random
|
||||
|
||||
from itim.models.services import Port
|
||||
|
||||
|
||||
|
||||
@pytest.fixture( scope = 'class')
|
||||
def model_port():
|
||||
|
||||
yield Port
|
||||
|
||||
|
||||
@pytest.fixture( scope = 'class')
|
||||
def kwargs_port(kwargs_centurionmodel):
|
||||
|
||||
random_port = random.randrange(1, 65535, 50)
|
||||
|
||||
kwargs = {
|
||||
**kwargs_centurionmodel.copy(),
|
||||
'number': random_port,
|
||||
'protocol': Port.Protocol.TCP
|
||||
}
|
||||
|
||||
yield kwargs.copy()
|
@ -1093,6 +1093,7 @@ markers = [
|
||||
"model_manufacturer: Select all manufacturer tests.",
|
||||
"model_operatingsystem: Select tests for model Operating System",
|
||||
"model_operatingsystemversion: Select tests for model Operating System Version",
|
||||
"model_port: Selects tests for model port",
|
||||
"model_software: Selects tests for model Software.",
|
||||
"model_softwarecateory: Selects tests for model Software Category.",
|
||||
"model_softwareenablefeatureflag: Selects tests for model Software Enabled Feature Flag.",
|
||||
|
Reference in New Issue
Block a user