thousandeyes-sdk-python/test_templates_api/test/test_test_template_collection.py
2023-12-11 09:29:15 +00:00

82 lines
6.9 KiB
Python

# coding: utf-8
"""
Test Template
## Overview Test templates allow you create a set of tests, alert rules, dashboards, and labels from a single template configuration file. The following applies to test templates: * You can create tests for monitoring common services and applications such as Microsoft 365, Webex, and others using a predefined set of certified templates. * Test templates reduce the time and complexity of creating tests for common SaaS or other services by providing a set of templates for creating tests, alert rules, and other assets within the ThousandEyes platform. * Templates created with an account group in a particular organization are visible to all account groups in that organization, provided they have the `View Test Templates` permission. * Credentials (usernames, passwords, tokens, etc.) can be included in a test template only as placeholders whose value is provided by user input when the template is deployed. Creating or updating a test template that contains a credentials field in plain text will result in a bad request (HTTP 400). * The schemas to use for `labels`, `tests`, `alertRules` and `dashboards` are defined at https://developer.thousandeyes.com/v7/. * To support referencing an asset from another asset of a different type (for example, defining the `testId` field of an `alertRule` by referencing the ID of a test defined in the template itself), the deployment of assets is done in a specific order: 1. Labels 2. Tests 3. Alert rules 4. Dashboards For a given asset type, you can reference any asset type with a higher order. (For example, labels cannot reference other assets in the template; tests can only reference labels; alert rules can reference tests and labels, etc.)
The version of the OpenAPI document: 7.0.1
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
import unittest
import datetime
from test_templates_api.models.test_template_collection import TestTemplateCollection
class TestTestTemplateCollection(unittest.TestCase):
"""TestTemplateCollection unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def make_instance(self, include_optional) -> TestTemplateCollection:
"""Test TestTemplateCollection
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included """
# uncomment below to create an instance of `TestTemplateCollection`
"""
model = TestTemplateCollection()
if include_optional:
return TestTemplateCollection(
templates = [
test_templates_api.models.test_template.TestTemplate(
id = 'fcbb89a7-61cf-4616-9c4f-828fa3cb4684',
name = 'OneDrive Template',
description = 'OneDrive Template',
icon = 'oneDrive.svg',
is_built_in = False,
certification_level = 'User',
date_created = '2022-09-28 13:25:15',
user_inputs = {"tenantName":{"title":"Tenant Name","description":"Name of OneDrive tenant; will be used in OneDrive URL","type":"string"},"agents":{"name":"Agent List","type":"any"}},
labels = {"templateLabel":{"name":"OneDrive Template"}},
tests = {"dnsTest":{"type":"object","example":{"domain":"{{userInputs.domain}} A","groups":[{"groupId":"{{labels.webHealthDashLabel.groupId}}"},{"groupId":"{{labels.templateLabel.groupId}}"}],"interval":"{{userInputs.interval}}","type":"dns-server","dnsServers":"{{userInputs.dnsServers}}","testName":"{{name}} - DNS","agents":"{{userInputs.agents}}"}},"httpServerTest":{"groups":[{"groupId":"{{labels.webHealthDashLabel.groupId}}"},{"groupId":"{{labels.templateLabel.groupId}}"}],"interval":"{{userInputs.interval}}","type":"http-server","url":"https://{{userInputs.domain}}","testName":"{{name}} - HTTP Server","agents":"{{userInputs.agents}}"},"networkTest":{"server":"{{userInputs.domain}}","protocol":"TCP","port":"{{userInputs.port}}","groups":{"groupId":"{{labels.webHealthDashLabel.groupId}}"},"interval":"{{userInputs.interval}}","type":"agent-to-server","url":"https://{{userInputs.domain}}","testName":"{{name}} - Network","agents":"{{userInputs.agents}}"},"pageLoadTest":{"name":"OneDrive PageLoad Test","type":"page-load","target":"https://{{tenantName}}-my.sharepoint.com","agents":"{{userInputs.agents}}"},"dnsServerTest":{"name":"OneDrive Dns Server Test","type":"dns-server","domain":"{{tenantName}}-my.sharepoint.com CNAME","agents":"{{userInputs.agents}}"}},
alert_rules = {"httpAlert":{"testIds":["{{tests.pageLoadTest.testId}}"],"severity":"MINOR","roundsViolatingRequired":1,"roundsViolatingOutOf":1,"alertType":"HTTP Server","expression":"((totalTime >= 500 ms) && (responseTime >= 500 ms))","ruleName":"{{name}} - HTTP Alert","minimumSources":1}},
dashboards = {"webHealthDashboard":{"title":"Web Health Overview","widgets":[{"metricGroup":"Web - HTTP Server","measure":{"type":"Mean"},"metric":"Total Time","filters":{"Test Labels":"[{{labels.webHealthDashLabel.groupId}}]"},"groupBy":"Tests","type":"Time Series: Line","title":"HTTP Response Times","dataSource":"Cloud & Enterprise Agents"}]}},
deployment_strategy = {"testVoiceLabel":"Update on Change","testVideoLabel":"Update on Change","testLabel":"Update on Change","dnsTest":"Ignore on Change","webexDashboard":"Ignore on Change","serverTest":"Ignore on Change"},
_links = {
'key' : test_templates_api.models.link.Link(
href = '',
hreflang = '',
title = '',
type = '',
deprecation = '',
profile = '',
name = '',
templated = True, )
}, )
],
links = test_templates_api.models.test_template_collection__links.TestTemplateCollection__links(
self = test_templates_api.models.test_template_collection__links_self.TestTemplateCollection__links_self(
href = 'https://api.thousandeyes.com/v7/tests/templates/6c6bc11c-0332-4e28-9efb-f171a14be824', ), )
)
else:
return TestTemplateCollection(
)
"""
def testTestTemplateCollection(self):
"""Test TestTemplateCollection"""
# inst_req_only = self.make_instance(include_optional=False)
# inst_req_and_optional = self.make_instance(include_optional=True)
if __name__ == '__main__':
unittest.main()