Commit 104cd4c1 authored by Dmitry Volodin's avatar Dmitry Volodin
Browse files

test: models testing checks allow_inheritance and strict settings

--HG--
branch : feature/microservices
parent 30d69c68
......@@ -35,7 +35,7 @@ class DashboardAccess(EmbeddedDocument):
class Dashboard(Document):
meta = {
"collection": "noc.dashboards",
"allow_inheritance": False,
"strict": False,
"indexes": [
"owner", "tags"
]
......
......@@ -46,6 +46,7 @@ class DashboardCell(EmbeddedDocument):
class DashboardLayout(Document):
meta = {
"collection": "noc.dashboardlayouts",
"strict": False,
"json_collection": "bi.dashboardlayouts"
}
......
......@@ -19,6 +19,7 @@ from noc.lib.text import quote_safe_path
class ErrorType(Document):
meta = {
"collection": "noc.errortypes",
"strict": False,
"json_collection": "cm.errortypes"
}
name = StringField(unique=True)
......
......@@ -19,6 +19,7 @@ from noc.lib.nosql import ForeignKeyField
class ObjectFact(Document):
meta = {
"collection": "noc.objectfacts",
"strict": False,
"indexes": [
"object",
"attrs.rule"
......
......@@ -23,7 +23,8 @@ class RuleItem(EmbeddedDocument):
class ValidationPolicy(Document):
meta = {
"collection": "noc.validationpolicy"
"collection": "noc.validationpolicy",
"strict": False
}
name = StringField(unique=True)
......
......@@ -25,6 +25,7 @@ class ValidationPolicyItem(EmbeddedDocument):
class ValidationPolicySettings(Document):
meta = {
"collection": "noc.validationpolicysettings",
"strict": False,
"indexes": [("model_id", "object_id")]
}
model_id = StringField()
......
......@@ -50,7 +50,8 @@ class ObjectItem(EmbeddedDocument):
class ValidationRule(Document):
meta = {
"collection": "noc.validationrules"
"collection": "noc.validationrules",
"strict": False
}
name = StringField(unique=True)
......
......@@ -19,7 +19,8 @@ from noc.main.models.style import Style
class SubscriberProfile(Document):
meta = {
"collection": "noc.subscriberprofiles"
"collection": "noc.subscriberprofiles",
"strict": False
}
name = StringField(unique=True)
......
# -*- coding: utf-8 -*-
##----------------------------------------------------------------------
## Supplier Group
##----------------------------------------------------------------------
## Copyright (C) 2007-2016 The NOC Project
## See LICENSE for details
##----------------------------------------------------------------------
# ----------------------------------------------------------------------
# Supplier Group
# ----------------------------------------------------------------------
# Copyright (C) 2007-2017 The NOC Project
# See LICENSE for details
# ----------------------------------------------------------------------
## Third-party modules
# Third-party modules
from mongoengine.document import Document
from mongoengine.fields import StringField, ListField
## NOC modules
# NOC modules
from noc.lib.nosql import ForeignKeyField
from noc.main.models.style import Style
class SupplierProfile(Document):
meta = {
"collection": "noc.supplierprofiles"
"collection": "noc.supplierprofiles",
"strict": False
}
name = StringField(unique=True)
......
......@@ -33,7 +33,7 @@ ALARM_CLOSE_RETRIES = config.fm.alarm_close_retries
class ActiveAlarm(nosql.Document):
meta = {
"collection": "noc.alarms.active",
"allow_inheritance": False,
"strict": False,
"indexes": [
"timestamp", "root", "-severity",
("alarm_class", "managed_object"),
......
......@@ -35,7 +35,7 @@ class ActiveEvent(Document):
"""
meta = {
"collection": "noc.events.active",
"allow_inheritance": False,
"strict": False,
"indexes": [
"timestamp", "discriminator", "alarms",
("timestamp", "event_class", "managed_object"),
......
......@@ -36,11 +36,11 @@ class AlarmClass(nosql.Document):
"""
meta = {
"collection": "noc.alarmclasses",
"allow_inheritance": False,
"strict": False,
"json_collection": "fm.alarmclasses",
"json_depends_on": [
"fm.alarmseverities"
]
],
}
name = fields.StringField(required=True, unique=True)
......
......@@ -13,7 +13,7 @@ import noc.lib.nosql as nosql
class AlarmClassCategory(nosql.Document):
meta = {
"collection": "noc.alartmclasscategories", # @todo: Fix bug
"allow_inheritance": False
"strict": False
}
name = nosql.StringField()
parent = nosql.ObjectIdField(required=False)
......
......@@ -20,7 +20,7 @@ class AlarmClassConfig(Document):
"""
meta = {
"collection": "noc.alarmclassconfigs",
"allow_inheritance": False
"strict": False
}
alarm_class = PlainReferenceField(AlarmClass, unique=True)
......
......@@ -12,7 +12,7 @@ import noc.lib.nosql as nosql
class AlarmClassVar(nosql.EmbeddedDocument):
meta = {
"allow_inheritance": False
"strict": False
}
name = nosql.StringField(required=True)
description = nosql.StringField(required=False)
......
......@@ -20,6 +20,7 @@ import bson
class AlarmDiagnostic(Document):
meta = {
"collection": "noc.alarmdiagnostic",
"strict": False,
"indexes": [
"alarm"
]
......
......@@ -35,6 +35,7 @@ logger = logging.getLogger(__name__)
class AlarmDiagnosticConfig(Document):
meta = {
"collection": "noc.alarmdiagnosticconfig",
"strict": False,
"indexes": [
"alarm_class"
]
......
......@@ -68,7 +68,7 @@ class AlarmEscalation(Document):
"""
meta = {
"collection": "noc.alarmescalatons",
"allow_inheritance": False
"strict": False
}
name = StringField(unique=True)
......
......@@ -12,7 +12,7 @@ import noc.lib.nosql as nosql
class AlarmLog(nosql.EmbeddedDocument):
meta = {
"allow_inheritance": False
"strict": False
}
timestamp = nosql.DateTimeField()
from_status = nosql.StringField(
......
......@@ -13,7 +13,7 @@ from mongoengine.document import EmbeddedDocument, Document
class AlarmPlugin(EmbeddedDocument):
meta = {
"allow_inheritance": False
"strict": False
}
name = fields.StringField()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment