python-eigen-ingenuity 0.5.18b2__tar.gz → 0.5.18b3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {python_eigen_ingenuity-0.5.18b2 → python_eigen_ingenuity-0.5.18b3}/PKG-INFO +1 -1
- {python_eigen_ingenuity-0.5.18b2 → python_eigen_ingenuity-0.5.18b3}/eigeningenuity/__init__.py +2 -1
- {python_eigen_ingenuity-0.5.18b2 → python_eigen_ingenuity-0.5.18b3}/eigeningenuity/core/__init__.py +9 -3
- {python_eigen_ingenuity-0.5.18b2 → python_eigen_ingenuity-0.5.18b3}/eigeningenuity/historianmulti.py +7 -0
- python_eigen_ingenuity-0.5.18b3/local-tests/__init__.py +4 -0
- python_eigen_ingenuity-0.5.18b3/local-tests/common.py +45 -0
- python_eigen_ingenuity-0.5.18b3/local-tests/config.py +29 -0
- python_eigen_ingenuity-0.5.18b3/local-tests/demo.py +81 -0
- python_eigen_ingenuity-0.5.18b3/local-tests/historian/__init__.py +1 -0
- python_eigen_ingenuity-0.5.18b3/local-tests/historian/test_getCurrentDataPoints.py +70 -0
- python_eigen_ingenuity-0.5.18b3/local-tests/historian/test_getInterpolatedPoints.py +80 -0
- python_eigen_ingenuity-0.5.18b3/local-tests/historian/test_getInterpolatedRange.py +99 -0
- python_eigen_ingenuity-0.5.18b3/local-tests/historian/test_getMetaData.py +47 -0
- python_eigen_ingenuity-0.5.18b3/local-tests/historian/test_getRawDataPoints.py +92 -0
- python_eigen_ingenuity-0.5.18b3/local-tests/historian/test_listDataTags.py +51 -0
- python_eigen_ingenuity-0.5.18b3/local-tests/historian/test_writePoints.py +57 -0
- python_eigen_ingenuity-0.5.18b3/local-tests/historianmulti/__init__.py +1 -0
- python_eigen_ingenuity-0.5.18b3/local-tests/historianmulti/common_multi.py +46 -0
- python_eigen_ingenuity-0.5.18b3/local-tests/historianmulti/test_getClosestRawPoint.py +74 -0
- python_eigen_ingenuity-0.5.18b3/local-tests/historianmulti/test_getCurrentDataPoints.py +53 -0
- python_eigen_ingenuity-0.5.18b3/local-tests/historianmulti/test_getInterpolatedPoints.py +69 -0
- python_eigen_ingenuity-0.5.18b3/local-tests/historianmulti/test_getInterpolatedRange.py +85 -0
- python_eigen_ingenuity-0.5.18b3/local-tests/historianmulti/test_getMetaData.py +51 -0
- python_eigen_ingenuity-0.5.18b3/local-tests/historianmulti/test_getRawDatapoints.py +85 -0
- python_eigen_ingenuity-0.5.18b3/local-tests/historianmulti/test_listDataTags.py +59 -0
- python_eigen_ingenuity-0.5.18b3/local-tests/historianmulti/test_tagManagement.py +88 -0
- python_eigen_ingenuity-0.5.18b3/local-tests/historianmulti/test_writePoints.py +70 -0
- python_eigen_ingenuity-0.5.18b3/local-tests/run_tests.py +461 -0
- python_eigen_ingenuity-0.5.18b3/pyproject.toml +14 -0
- {python_eigen_ingenuity-0.5.18b2 → python_eigen_ingenuity-0.5.18b3}/python_eigen_ingenuity.egg-info/PKG-INFO +1 -1
- python_eigen_ingenuity-0.5.18b3/python_eigen_ingenuity.egg-info/SOURCES.txt +100 -0
- {python_eigen_ingenuity-0.5.18b2 → python_eigen_ingenuity-0.5.18b3}/python_eigen_ingenuity.egg-info/top_level.txt +2 -0
- python_eigen_ingenuity-0.5.18b3/regressiontests/__init__.py +1 -0
- python_eigen_ingenuity-0.5.18b3/regressiontests/eigeningenuity/__init__.py +1 -0
- python_eigen_ingenuity-0.5.18b3/regressiontests/eigeningenuity/common.py +137 -0
- python_eigen_ingenuity-0.5.18b3/regressiontests/eigeningenuity/common_multi.py +133 -0
- python_eigen_ingenuity-0.5.18b3/regressiontests/eigeningenuity/historian/__init__.py +1 -0
- python_eigen_ingenuity-0.5.18b3/regressiontests/eigeningenuity/historian/common.py +113 -0
- python_eigen_ingenuity-0.5.18b3/regressiontests/eigeningenuity/historian/test_getCurrentDataPoints.py +163 -0
- python_eigen_ingenuity-0.5.18b3/regressiontests/eigeningenuity/historian/test_getInterpolatedPoints.py +175 -0
- python_eigen_ingenuity-0.5.18b3/regressiontests/eigeningenuity/historian/test_getInterpolatedRange.py +203 -0
- python_eigen_ingenuity-0.5.18b3/regressiontests/eigeningenuity/historian/test_getMetaData.py +102 -0
- python_eigen_ingenuity-0.5.18b3/regressiontests/eigeningenuity/historian/test_getRawDataPoints.py +214 -0
- python_eigen_ingenuity-0.5.18b3/regressiontests/eigeningenuity/historian/test_listDataTags.py +48 -0
- python_eigen_ingenuity-0.5.18b3/regressiontests/eigeningenuity/historian/test_writePoints.py +54 -0
- python_eigen_ingenuity-0.5.18b3/regressiontests/eigeningenuity/historian-multi/__init__.py +1 -0
- python_eigen_ingenuity-0.5.18b3/regressiontests/eigeningenuity/historian-multi/common_multi.py +143 -0
- python_eigen_ingenuity-0.5.18b3/regressiontests/eigeningenuity/historian-multi/test_getClosestRawPoint.py +123 -0
- python_eigen_ingenuity-0.5.18b3/regressiontests/eigeningenuity/historian-multi/test_getCurrentDataPoints.py +117 -0
- python_eigen_ingenuity-0.5.18b3/regressiontests/eigeningenuity/historian-multi/test_getInterpolatedPoints.py +124 -0
- python_eigen_ingenuity-0.5.18b3/regressiontests/eigeningenuity/historian-multi/test_getInterpolatedRange.py +139 -0
- python_eigen_ingenuity-0.5.18b3/regressiontests/eigeningenuity/historian-multi/test_getMetaData.py +48 -0
- python_eigen_ingenuity-0.5.18b3/regressiontests/eigeningenuity/historian-multi/test_getRawDatapoints.py +153 -0
- python_eigen_ingenuity-0.5.18b3/regressiontests/eigeningenuity/historian-multi/test_listDataTags.py +56 -0
- python_eigen_ingenuity-0.5.18b3/regressiontests/eigeningenuity/historian-multi/test_tagManagement.py +129 -0
- python_eigen_ingenuity-0.5.18b3/regressiontests/eigeningenuity/historian-multi/test_writePoints.py +67 -0
- python_eigen_ingenuity-0.5.18b2/pyproject.toml +0 -3
- python_eigen_ingenuity-0.5.18b2/python_eigen_ingenuity.egg-info/SOURCES.txt +0 -52
- {python_eigen_ingenuity-0.5.18b2 → python_eigen_ingenuity-0.5.18b3}/MANIFEST.in +0 -0
- {python_eigen_ingenuity-0.5.18b2 → python_eigen_ingenuity-0.5.18b3}/README-nocli.md +0 -0
- {python_eigen_ingenuity-0.5.18b2 → python_eigen_ingenuity-0.5.18b3}/README.md +0 -0
- {python_eigen_ingenuity-0.5.18b2 → python_eigen_ingenuity-0.5.18b3}/eigeningenuity/assetmodel.py +0 -0
- {python_eigen_ingenuity-0.5.18b2 → python_eigen_ingenuity-0.5.18b3}/eigeningenuity/auth.py +0 -0
- {python_eigen_ingenuity-0.5.18b2 → python_eigen_ingenuity-0.5.18b3}/eigeningenuity/elastic.py +0 -0
- {python_eigen_ingenuity-0.5.18b2 → python_eigen_ingenuity-0.5.18b3}/eigeningenuity/events.py +0 -0
- {python_eigen_ingenuity-0.5.18b2 → python_eigen_ingenuity-0.5.18b3}/eigeningenuity/historian.py +0 -0
- {python_eigen_ingenuity-0.5.18b2 → python_eigen_ingenuity-0.5.18b3}/eigeningenuity/settings.py +0 -0
- {python_eigen_ingenuity-0.5.18b2 → python_eigen_ingenuity-0.5.18b3}/eigeningenuity/smartdash.py +0 -0
- {python_eigen_ingenuity-0.5.18b2 → python_eigen_ingenuity-0.5.18b3}/eigeningenuity/sql.py +0 -0
- {python_eigen_ingenuity-0.5.18b2 → python_eigen_ingenuity-0.5.18b3}/eigeningenuity/util.py +0 -0
- {python_eigen_ingenuity-0.5.18b2 → python_eigen_ingenuity-0.5.18b3}/modelbuilder/__init__.py +0 -0
- {python_eigen_ingenuity-0.5.18b2 → python_eigen_ingenuity-0.5.18b3}/modelbuilder/src/__init__.py +0 -0
- {python_eigen_ingenuity-0.5.18b2 → python_eigen_ingenuity-0.5.18b3}/modelbuilder/src/assetmodelbuilder.py +0 -0
- {python_eigen_ingenuity-0.5.18b2 → python_eigen_ingenuity-0.5.18b3}/modelbuilder/src/assetmodelcsvwriter.py +0 -0
- {python_eigen_ingenuity-0.5.18b2 → python_eigen_ingenuity-0.5.18b3}/modelbuilder/src/assetmodelutilities.py +0 -0
- {python_eigen_ingenuity-0.5.18b2 → python_eigen_ingenuity-0.5.18b3}/modelbuilder/src/configmanager.py +0 -0
- {python_eigen_ingenuity-0.5.18b2 → python_eigen_ingenuity-0.5.18b3}/modelbuilder/src/connectors/__init__.py +0 -0
- {python_eigen_ingenuity-0.5.18b2 → python_eigen_ingenuity-0.5.18b3}/modelbuilder/src/connectors/boltconnector.py +0 -0
- {python_eigen_ingenuity-0.5.18b2 → python_eigen_ingenuity-0.5.18b3}/modelbuilder/src/connectors/dbconnectors.py +0 -0
- {python_eigen_ingenuity-0.5.18b2 → python_eigen_ingenuity-0.5.18b3}/modelbuilder/src/connectors/genericconnector.py +0 -0
- {python_eigen_ingenuity-0.5.18b2 → python_eigen_ingenuity-0.5.18b3}/modelbuilder/src/connectors/httpsconnector.py +0 -0
- {python_eigen_ingenuity-0.5.18b2 → python_eigen_ingenuity-0.5.18b3}/modelbuilder/src/csvcontentsmanager.py +0 -0
- {python_eigen_ingenuity-0.5.18b2 → python_eigen_ingenuity-0.5.18b3}/modelbuilder/src/csvwriter.py +0 -0
- {python_eigen_ingenuity-0.5.18b2 → python_eigen_ingenuity-0.5.18b3}/modelbuilder/src/fileanalyser.py +0 -0
- {python_eigen_ingenuity-0.5.18b2 → python_eigen_ingenuity-0.5.18b3}/modelbuilder/src/filemanager.py +0 -0
- {python_eigen_ingenuity-0.5.18b2 → python_eigen_ingenuity-0.5.18b3}/modelbuilder/src/messages.py +0 -0
- {python_eigen_ingenuity-0.5.18b2 → python_eigen_ingenuity-0.5.18b3}/modelbuilder/src/processors/__init__.py +0 -0
- {python_eigen_ingenuity-0.5.18b2 → python_eigen_ingenuity-0.5.18b3}/modelbuilder/src/processors/cypherfileprocessor.py +0 -0
- {python_eigen_ingenuity-0.5.18b2 → python_eigen_ingenuity-0.5.18b3}/modelbuilder/src/processors/labelmanager.py +0 -0
- {python_eigen_ingenuity-0.5.18b2 → python_eigen_ingenuity-0.5.18b3}/modelbuilder/src/processors/nodefileprocessor.py +0 -0
- {python_eigen_ingenuity-0.5.18b2 → python_eigen_ingenuity-0.5.18b3}/modelbuilder/src/processors/propertymanager.py +0 -0
- {python_eigen_ingenuity-0.5.18b2 → python_eigen_ingenuity-0.5.18b3}/modelbuilder/src/processors/relationshipfileprocessor.py +0 -0
- {python_eigen_ingenuity-0.5.18b2 → python_eigen_ingenuity-0.5.18b3}/modelbuilder/src/processors/relationshipmanager.py +0 -0
- {python_eigen_ingenuity-0.5.18b2 → python_eigen_ingenuity-0.5.18b3}/modelbuilder/src/property.py +0 -0
- {python_eigen_ingenuity-0.5.18b2 → python_eigen_ingenuity-0.5.18b3}/modelbuilder/src/queries/__init__.py +0 -0
- {python_eigen_ingenuity-0.5.18b2 → python_eigen_ingenuity-0.5.18b3}/modelbuilder/src/queries/cypherbuilder.py +0 -0
- {python_eigen_ingenuity-0.5.18b2 → python_eigen_ingenuity-0.5.18b3}/modelbuilder/src/queries/query.py +0 -0
- {python_eigen_ingenuity-0.5.18b2 → python_eigen_ingenuity-0.5.18b3}/modelbuilder/src/versionmanager.py +0 -0
- {python_eigen_ingenuity-0.5.18b2 → python_eigen_ingenuity-0.5.18b3}/python_eigen_ingenuity.egg-info/dependency_links.txt +0 -0
- {python_eigen_ingenuity-0.5.18b2 → python_eigen_ingenuity-0.5.18b3}/python_eigen_ingenuity.egg-info/entry_points.txt +0 -0
- {python_eigen_ingenuity-0.5.18b2 → python_eigen_ingenuity-0.5.18b3}/python_eigen_ingenuity.egg-info/requires.txt +0 -0
- {python_eigen_ingenuity-0.5.18b2 → python_eigen_ingenuity-0.5.18b3}/requirements.txt +0 -0
- {python_eigen_ingenuity-0.5.18b2 → python_eigen_ingenuity-0.5.18b3}/setup.cfg +0 -0
- {python_eigen_ingenuity-0.5.18b2 → python_eigen_ingenuity-0.5.18b3}/setup.py +0 -0
{python_eigen_ingenuity-0.5.18b2 → python_eigen_ingenuity-0.5.18b3}/eigeningenuity/__init__.py
RENAMED
|
@@ -28,8 +28,9 @@ from eigeningenuity.assetmodel import get_assetmodel
|
|
|
28
28
|
from eigeningenuity.smartdash import get_smartdash
|
|
29
29
|
from eigeningenuity.sql import get_sql
|
|
30
30
|
from eigeningenuity.settings import set_azure_tenant_id, set_azure_client_id, set_azure_client_secret, disable_azure_auth, disable_auth_token_cache, clear_auth_token_cache, set_api_token, set_auth_scope
|
|
31
|
+
from eigeningenuity.util import EigenException
|
|
31
32
|
|
|
32
|
-
__all__ = ["get_historian", "get_historian_multi", "get_assetmodel", "get_elastic", "get_sql", "get_eventlog", "get_smartdash", "list_historians", "EigenServer", "set_azure_tenant_id", "set_azure_client_id", "set_azure_client_secret", "disable_azure_auth", "disable_auth_token_cache", "clear_auth_token_cache", "set_api_token", "set_auth_scope"]
|
|
33
|
+
__all__ = ["get_historian", "get_historian_multi", "get_assetmodel", "get_elastic", "get_sql", "get_eventlog", "get_smartdash", "list_historians", "EigenServer", "set_azure_tenant_id", "set_azure_client_id", "set_azure_client_secret", "disable_azure_auth", "disable_auth_token_cache", "clear_auth_token_cache", "set_api_token", "set_auth_scope", "EigenException"]
|
|
33
34
|
try:
|
|
34
35
|
__version__ = version("python-eigen-ingenuity")
|
|
35
36
|
except PackageNotFoundError:
|
{python_eigen_ingenuity-0.5.18b2 → python_eigen_ingenuity-0.5.18b3}/eigeningenuity/core/__init__.py
RENAMED
|
@@ -15,7 +15,9 @@ hostname, or hostname:port combination. If no variable is set, it defaults
|
|
|
15
15
|
to http://localhost:8080/
|
|
16
16
|
"""
|
|
17
17
|
|
|
18
|
-
import sys
|
|
18
|
+
import sys
|
|
19
|
+
import os
|
|
20
|
+
import requests
|
|
19
21
|
from eigeningenuity.util import _do_eigen_json_request, EigenException, RemoteServerException, serverTimeToPythonTime, _authenticate_azure_user
|
|
20
22
|
import eigeningenuity.settings as settings
|
|
21
23
|
|
|
@@ -52,7 +54,11 @@ class EigenServer (object):
|
|
|
52
54
|
baseurl = "http://localhost:8080/"
|
|
53
55
|
|
|
54
56
|
if settings._azure_auth_enabled_:
|
|
55
|
-
preflight = requests.get(baseurl + "historian
|
|
57
|
+
preflight = requests.get(baseurl + "/historian/list", verify=False)
|
|
58
|
+
|
|
59
|
+
# Old Method, not sure if any servers still use this and cant use the new one, but backwards compatibility
|
|
60
|
+
if preflight.status_code != 200:
|
|
61
|
+
preflight = requests.get(baseurl + "historian-servlet/jsonbridge/calc?cmd=LISTHISTORIANS", verify=False)
|
|
56
62
|
|
|
57
63
|
if preflight.status_code != 200:
|
|
58
64
|
raise EigenException("Could not find an ingenuity Instance at this url: ", baseurl)
|
|
@@ -60,7 +66,7 @@ class EigenServer (object):
|
|
|
60
66
|
try:
|
|
61
67
|
preflight.json()
|
|
62
68
|
self.auth = False
|
|
63
|
-
except:
|
|
69
|
+
except Exception:
|
|
64
70
|
self.auth = True
|
|
65
71
|
else:
|
|
66
72
|
self.auth = False
|
{python_eigen_ingenuity-0.5.18b2 → python_eigen_ingenuity-0.5.18b3}/eigeningenuity/historianmulti.py
RENAMED
|
@@ -485,6 +485,13 @@ class HistorianMulti (object):
|
|
|
485
485
|
createSuccess = False
|
|
486
486
|
else:
|
|
487
487
|
createSuccess = True
|
|
488
|
+
|
|
489
|
+
body = {
|
|
490
|
+
"points": {
|
|
491
|
+
tag: force_list(points)
|
|
492
|
+
},
|
|
493
|
+
"createTags": False
|
|
494
|
+
}
|
|
488
495
|
|
|
489
496
|
message = _do_historian_multi_request(self.writeurl,body,self.auth,True)
|
|
490
497
|
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Common test configuration and utilities for historian tests
|
|
3
|
+
"""
|
|
4
|
+
import sys
|
|
5
|
+
import os
|
|
6
|
+
import unittest
|
|
7
|
+
import warnings
|
|
8
|
+
from datetime import datetime
|
|
9
|
+
|
|
10
|
+
# Add the parent directory to the Python path to import local version
|
|
11
|
+
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '../..')))
|
|
12
|
+
|
|
13
|
+
# Import local version
|
|
14
|
+
from eigeningenuity import EigenServer, get_historian, disable_azure_auth
|
|
15
|
+
from urllib3.exceptions import InsecureRequestWarning
|
|
16
|
+
|
|
17
|
+
# Disable warnings and Azure auth for testing
|
|
18
|
+
warnings.simplefilter('ignore', InsecureRequestWarning)
|
|
19
|
+
disable_azure_auth()
|
|
20
|
+
|
|
21
|
+
class BaseHistorianTest(unittest.TestCase):
|
|
22
|
+
"""Base class for historian tests with common setup"""
|
|
23
|
+
|
|
24
|
+
def setUp(self):
|
|
25
|
+
"""Common setup for all historian tests"""
|
|
26
|
+
self.server = EigenServer("demo-dev.eigen.co")
|
|
27
|
+
self.historian_name = "Demo-influxdb"
|
|
28
|
+
self.historian = get_historian(self.historian_name, self.server)
|
|
29
|
+
self.test_datetime = datetime(2024, 5, 1, 2, 0, 0)
|
|
30
|
+
self.test_tags = ["DEMO_02TI301.PV", "DEMO_02TI201.PV"]
|
|
31
|
+
self.test_tags_with_historian = [f"{self.historian_name}/DEMO_02TI301.PV", f"{self.historian_name}/DEMO_02TI201.PV"]
|
|
32
|
+
self.calc_tag = "calc/ADD(1,2)"
|
|
33
|
+
|
|
34
|
+
def assertValidDataPoint(self, data_point):
|
|
35
|
+
"""Assert that a data point has valid structure"""
|
|
36
|
+
self.assertIsInstance(data_point, dict)
|
|
37
|
+
self.assertIn('value', data_point)
|
|
38
|
+
self.assertIn('timestamp', data_point)
|
|
39
|
+
self.assertIn('status', data_point)
|
|
40
|
+
|
|
41
|
+
def assertValidDataPointList(self, data_points):
|
|
42
|
+
"""Assert that a list of data points is valid"""
|
|
43
|
+
self.assertIsInstance(data_points, list)
|
|
44
|
+
for dp in data_points:
|
|
45
|
+
self.assertValidDataPoint(dp)
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Test configuration for Eigen Ingenuity Python Library Test Suite
|
|
3
|
+
|
|
4
|
+
This file contains configuration settings that can be easily modified
|
|
5
|
+
without changing individual test files.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
# Server configuration
|
|
9
|
+
TEST_SERVER = "demo-dev.eigen.co"
|
|
10
|
+
TEST_HISTORIAN = "Demo-influxdb"
|
|
11
|
+
|
|
12
|
+
# Test data configuration
|
|
13
|
+
TEST_TAGS = ["DEMO_02TI301.PV", "DEMO_02TI201.PV"]
|
|
14
|
+
TEST_CALC_TAG = "calc/ADD(1,2)"
|
|
15
|
+
|
|
16
|
+
# Test write tag prefix (for write operations)
|
|
17
|
+
TEST_WRITE_TAG_PREFIX = "eigen_manual_input/TEST_"
|
|
18
|
+
|
|
19
|
+
# Test time configuration (May 1, 2024 2:00:00 AM)
|
|
20
|
+
TEST_DATETIME_EPOCH = 1714525200
|
|
21
|
+
|
|
22
|
+
# Test limits and timeouts
|
|
23
|
+
DEFAULT_MAX_POINTS = 10
|
|
24
|
+
DEFAULT_TIMEOUT = 30 # seconds
|
|
25
|
+
|
|
26
|
+
# Test behavior settings
|
|
27
|
+
SKIP_WRITE_TESTS_ON_ERROR = True
|
|
28
|
+
SUPPRESS_SSL_WARNINGS = True
|
|
29
|
+
DISABLE_AZURE_AUTH = True
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Demo script to showcase the Eigen Ingenuity Test Suite
|
|
4
|
+
|
|
5
|
+
This script demonstrates how the test suite works and shows examples
|
|
6
|
+
of running different types of tests.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
import os
|
|
10
|
+
import subprocess
|
|
11
|
+
|
|
12
|
+
def run_command(cmd, description):
|
|
13
|
+
"""Run a command and display the results"""
|
|
14
|
+
print(f"\n{'='*60}")
|
|
15
|
+
print(f"DEMO: {description}")
|
|
16
|
+
print(f"Command: {cmd}")
|
|
17
|
+
print(f"{'='*60}")
|
|
18
|
+
|
|
19
|
+
try:
|
|
20
|
+
result = subprocess.run(cmd, shell=True, capture_output=True, text=True, cwd=project_root)
|
|
21
|
+
print(result.stdout)
|
|
22
|
+
if result.stderr:
|
|
23
|
+
print("STDERR:", result.stderr)
|
|
24
|
+
return result.returncode == 0
|
|
25
|
+
except Exception as e:
|
|
26
|
+
print(f"Error running command: {e}")
|
|
27
|
+
return False
|
|
28
|
+
|
|
29
|
+
def main():
|
|
30
|
+
global project_root
|
|
31
|
+
project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
|
|
32
|
+
|
|
33
|
+
print("Eigen Ingenuity Python Library Test Suite - DEMO")
|
|
34
|
+
print("=" * 60)
|
|
35
|
+
print(f"Project root: {project_root}")
|
|
36
|
+
print()
|
|
37
|
+
print("This demo shows how to use the comprehensive test suite")
|
|
38
|
+
print("that tests the LOCAL development version of the library.")
|
|
39
|
+
|
|
40
|
+
# Demo 1: List available tests
|
|
41
|
+
run_command("python3 tests/run_tests.py --list",
|
|
42
|
+
"List all available test modules")
|
|
43
|
+
|
|
44
|
+
# Demo 2: Run a specific test with verbose output
|
|
45
|
+
run_command("python3 tests/run_tests.py historian.getCurrentDataPoints --verbose",
|
|
46
|
+
"Run specific historian test with verbose output")
|
|
47
|
+
|
|
48
|
+
# Demo 3: Run all historian tests quietly
|
|
49
|
+
run_command("python3 tests/run_tests.py historian --quiet",
|
|
50
|
+
"Run all historian tests with quiet output")
|
|
51
|
+
|
|
52
|
+
# Demo 4: Show the bash script method
|
|
53
|
+
print(f"\n{'='*60}")
|
|
54
|
+
print("DEMO: Alternative - Using the bash script")
|
|
55
|
+
print("Command: ./tests/run_all_tests.sh historian")
|
|
56
|
+
print(f"{'='*60}")
|
|
57
|
+
print("You can also run tests using the bash script:")
|
|
58
|
+
print(" ./tests/run_all_tests.sh # All tests")
|
|
59
|
+
print(" ./tests/run_all_tests.sh historian # Historian tests")
|
|
60
|
+
print(" ./tests/run_all_tests.sh historianmulti # HistorianMulti tests")
|
|
61
|
+
|
|
62
|
+
print(f"\n{'='*60}")
|
|
63
|
+
print("DEMO COMPLETE")
|
|
64
|
+
print(f"{'='*60}")
|
|
65
|
+
print()
|
|
66
|
+
print("Test Suite Features:")
|
|
67
|
+
print("✓ Tests LOCAL development version (not installed package)")
|
|
68
|
+
print("✓ Comprehensive coverage of historian and historianmulti functions")
|
|
69
|
+
print("✓ Organized by function in separate test files")
|
|
70
|
+
print("✓ Easy to run individual tests or test suites")
|
|
71
|
+
print("✓ Graceful handling of network issues and permissions")
|
|
72
|
+
print("✓ Clear reporting and error messages")
|
|
73
|
+
print()
|
|
74
|
+
print("Next steps:")
|
|
75
|
+
print("1. Run individual function tests during development")
|
|
76
|
+
print("2. Run full test suite before commits")
|
|
77
|
+
print("3. Add new tests when adding new functions")
|
|
78
|
+
print("4. Use in CI/CD pipelines for automated testing")
|
|
79
|
+
|
|
80
|
+
if __name__ == '__main__':
|
|
81
|
+
main()
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Historian module tests"""
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Test getCurrentDataPoints function from historian module
|
|
3
|
+
"""
|
|
4
|
+
import sys
|
|
5
|
+
import os
|
|
6
|
+
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '../../')))
|
|
7
|
+
|
|
8
|
+
from tests.common import BaseHistorianTest
|
|
9
|
+
import unittest
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class TestGetCurrentDataPoints(BaseHistorianTest):
|
|
13
|
+
"""Test cases for getCurrentDataPoints function"""
|
|
14
|
+
|
|
15
|
+
def test_get_current_single_tag_default(self):
|
|
16
|
+
"""Test getting current data point for single tag with default output"""
|
|
17
|
+
result = self.historian.getCurrentDataPoints(self.test_tags[0])
|
|
18
|
+
self.assertValidDataPoint(result)
|
|
19
|
+
|
|
20
|
+
def test_get_current_single_tag_json(self):
|
|
21
|
+
"""Test getting current data point for single tag with json output"""
|
|
22
|
+
result = self.historian.getCurrentDataPoints(self.test_tags[0], output="json")
|
|
23
|
+
self.assertValidDataPoint(result)
|
|
24
|
+
|
|
25
|
+
def test_get_current_multiple_tags(self):
|
|
26
|
+
"""Test getting current data points for multiple tags"""
|
|
27
|
+
result = self.historian.getCurrentDataPoints(self.test_tags)
|
|
28
|
+
# Multiple tags return a dictionary, not a list
|
|
29
|
+
self.assertIsInstance(result, dict)
|
|
30
|
+
self.assertEqual(len(result), len(self.test_tags))
|
|
31
|
+
for tag in self.test_tags:
|
|
32
|
+
self.assertIn(tag, result)
|
|
33
|
+
self.assertValidDataPoint(result[tag])
|
|
34
|
+
|
|
35
|
+
def test_get_current_with_historian_prefix(self):
|
|
36
|
+
"""Test getting current data point with historian prefix"""
|
|
37
|
+
# Note: historian prefix might cause issues with the tag format
|
|
38
|
+
try:
|
|
39
|
+
result = self.historian.getCurrentDataPoints(self.test_tags_with_historian[0])
|
|
40
|
+
self.assertValidDataPoint(result)
|
|
41
|
+
except Exception:
|
|
42
|
+
# Historian prefix might not work as expected
|
|
43
|
+
self.skipTest("Historian prefix format not supported in this context")
|
|
44
|
+
|
|
45
|
+
def test_get_current_calc_tag(self):
|
|
46
|
+
"""Test getting current data point for calculation tag"""
|
|
47
|
+
# Note: calc tags might not be available in Demo-influxdb historian
|
|
48
|
+
try:
|
|
49
|
+
result = self.historian.getCurrentDataPoints(self.calc_tag)
|
|
50
|
+
self.assertValidDataPoint(result)
|
|
51
|
+
self.assertEqual(result['value'], 3) # ADD(1,2) should equal 3
|
|
52
|
+
except Exception:
|
|
53
|
+
# Calc tags might not be available in this historian
|
|
54
|
+
self.skipTest("Calc tags not available in Demo-influxdb historian")
|
|
55
|
+
|
|
56
|
+
def test_get_current_nonexistent_tag(self):
|
|
57
|
+
"""Test behavior with non-existent tag"""
|
|
58
|
+
with self.assertRaises(Exception):
|
|
59
|
+
self.historian.getCurrentDataPoints("NONEXISTENT_TAG")
|
|
60
|
+
|
|
61
|
+
def test_get_current_empty_tag_list(self):
|
|
62
|
+
"""Test behavior with empty tag list"""
|
|
63
|
+
result = self.historian.getCurrentDataPoints([])
|
|
64
|
+
# Empty tag list returns empty dict
|
|
65
|
+
self.assertIsInstance(result, dict)
|
|
66
|
+
self.assertEqual(len(result), 0)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
if __name__ == '__main__':
|
|
70
|
+
unittest.main()
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Test getInterpolatedPoints function from historian module
|
|
3
|
+
"""
|
|
4
|
+
import sys
|
|
5
|
+
import os
|
|
6
|
+
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '../../')))
|
|
7
|
+
|
|
8
|
+
from tests.common import BaseHistorianTest
|
|
9
|
+
import unittest
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class TestGetInterpolatedPoints(BaseHistorianTest):
|
|
13
|
+
"""Test cases for getInterpolatedPoints function"""
|
|
14
|
+
|
|
15
|
+
def test_get_interpolated_single_tag_single_timestamp(self):
|
|
16
|
+
"""Test getting interpolated point for single tag at single timestamp"""
|
|
17
|
+
result = self.historian.getInterpolatedPoints(
|
|
18
|
+
self.test_tags[0],
|
|
19
|
+
self.test_datetime
|
|
20
|
+
)
|
|
21
|
+
self.assertValidDataPoint(result)
|
|
22
|
+
|
|
23
|
+
def test_get_interpolated_single_tag_multiple_timestamps(self):
|
|
24
|
+
"""Test getting interpolated points for single tag at multiple timestamps"""
|
|
25
|
+
timestamps = [self.test_datetime, 1718180259]
|
|
26
|
+
result = self.historian.getInterpolatedPoints(
|
|
27
|
+
self.test_tags[0],
|
|
28
|
+
timestamps
|
|
29
|
+
)
|
|
30
|
+
self.assertIsInstance(result, list)
|
|
31
|
+
self.assertEqual(len(result), len(timestamps))
|
|
32
|
+
for dp in result:
|
|
33
|
+
self.assertValidDataPoint(dp)
|
|
34
|
+
|
|
35
|
+
def test_get_interpolated_multiple_tags_single_timestamp(self):
|
|
36
|
+
"""Test getting interpolated points for multiple tags at single timestamp"""
|
|
37
|
+
result = self.historian.getInterpolatedPoints(
|
|
38
|
+
self.test_tags,
|
|
39
|
+
self.test_datetime
|
|
40
|
+
)
|
|
41
|
+
self.assertIsInstance(result, list)
|
|
42
|
+
self.assertEqual(len(result), len(self.test_tags))
|
|
43
|
+
for dp in result:
|
|
44
|
+
self.assertValidDataPoint(dp)
|
|
45
|
+
|
|
46
|
+
def test_get_interpolated_multiple_tags_multiple_timestamps(self):
|
|
47
|
+
"""Test getting interpolated points for multiple tags at multiple timestamps"""
|
|
48
|
+
timestamps = [self.test_datetime, 1718180259]
|
|
49
|
+
result = self.historian.getInterpolatedPoints(
|
|
50
|
+
self.test_tags,
|
|
51
|
+
timestamps
|
|
52
|
+
)
|
|
53
|
+
self.assertIsInstance(result, list)
|
|
54
|
+
# Should return points for each tag at each timestamp
|
|
55
|
+
expected_length = len(self.test_tags) * len(timestamps)
|
|
56
|
+
self.assertEqual(len(result), expected_length)
|
|
57
|
+
for dp in result:
|
|
58
|
+
self.assertValidDataPoint(dp)
|
|
59
|
+
|
|
60
|
+
def test_get_interpolated_with_json_output(self):
|
|
61
|
+
"""Test getting interpolated points with json output format"""
|
|
62
|
+
result = self.historian.getInterpolatedPoints(
|
|
63
|
+
self.test_tags[0],
|
|
64
|
+
self.test_datetime,
|
|
65
|
+
output="json"
|
|
66
|
+
)
|
|
67
|
+
self.assertValidDataPoint(result)
|
|
68
|
+
|
|
69
|
+
def test_get_interpolated_with_epoch_timestamp(self):
|
|
70
|
+
"""Test getting interpolated points with epoch timestamp"""
|
|
71
|
+
epoch_time = 1714525200 # May 1, 2024 2:00:00 AM
|
|
72
|
+
result = self.historian.getInterpolatedPoints(
|
|
73
|
+
self.test_tags[0],
|
|
74
|
+
epoch_time
|
|
75
|
+
)
|
|
76
|
+
self.assertValidDataPoint(result)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
if __name__ == '__main__':
|
|
80
|
+
unittest.main()
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Test getInterpolatedRange function from historian module
|
|
3
|
+
"""
|
|
4
|
+
import sys
|
|
5
|
+
import os
|
|
6
|
+
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '../../')))
|
|
7
|
+
|
|
8
|
+
from tests.common import BaseHistorianTest
|
|
9
|
+
import unittest
|
|
10
|
+
from datetime import datetime, timedelta
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class TestGetInterpolatedRange(BaseHistorianTest):
|
|
14
|
+
"""Test cases for getInterpolatedRange function"""
|
|
15
|
+
|
|
16
|
+
def test_get_interpolated_range_single_tag(self):
|
|
17
|
+
"""Test getting interpolated range for single tag"""
|
|
18
|
+
end_time = datetime.now()
|
|
19
|
+
start_time = end_time - timedelta(hours=24)
|
|
20
|
+
|
|
21
|
+
result = self.historian.getInterpolatedRange(
|
|
22
|
+
self.test_tags[0],
|
|
23
|
+
start_time,
|
|
24
|
+
end_time,
|
|
25
|
+
num_points=10
|
|
26
|
+
)
|
|
27
|
+
self.assertIsInstance(result, list)
|
|
28
|
+
self.assertEqual(len(result), 10)
|
|
29
|
+
for dp in result:
|
|
30
|
+
self.assertValidDataPoint(dp)
|
|
31
|
+
|
|
32
|
+
def test_get_interpolated_range_multiple_tags(self):
|
|
33
|
+
"""Test getting interpolated range for multiple tags"""
|
|
34
|
+
end_time = datetime.now()
|
|
35
|
+
start_time = end_time - timedelta(hours=24)
|
|
36
|
+
num_points = 5
|
|
37
|
+
|
|
38
|
+
result = self.historian.getInterpolatedRange(
|
|
39
|
+
self.test_tags,
|
|
40
|
+
start_time,
|
|
41
|
+
end_time,
|
|
42
|
+
num_points=num_points
|
|
43
|
+
)
|
|
44
|
+
self.assertIsInstance(result, list)
|
|
45
|
+
# Should return num_points for each tag
|
|
46
|
+
expected_length = len(self.test_tags) * num_points
|
|
47
|
+
self.assertEqual(len(result), expected_length)
|
|
48
|
+
for dp in result:
|
|
49
|
+
self.assertValidDataPoint(dp)
|
|
50
|
+
|
|
51
|
+
def test_get_interpolated_range_with_json_output(self):
|
|
52
|
+
"""Test getting interpolated range with json output"""
|
|
53
|
+
end_time = datetime.now()
|
|
54
|
+
start_time = end_time - timedelta(hours=24)
|
|
55
|
+
|
|
56
|
+
result = self.historian.getInterpolatedRange(
|
|
57
|
+
self.test_tags[0],
|
|
58
|
+
start_time,
|
|
59
|
+
end_time,
|
|
60
|
+
num_points=5,
|
|
61
|
+
output="json"
|
|
62
|
+
)
|
|
63
|
+
self.assertIsInstance(result, list)
|
|
64
|
+
self.assertEqual(len(result), 5)
|
|
65
|
+
for dp in result:
|
|
66
|
+
self.assertValidDataPoint(dp)
|
|
67
|
+
|
|
68
|
+
def test_get_interpolated_range_with_epoch_times(self):
|
|
69
|
+
"""Test getting interpolated range with epoch timestamps"""
|
|
70
|
+
end_time = 1714525200 + 3600 # May 1, 2024 3:00:00 AM
|
|
71
|
+
start_time = 1714525200 # May 1, 2024 2:00:00 AM
|
|
72
|
+
|
|
73
|
+
result = self.historian.getInterpolatedRange(
|
|
74
|
+
self.test_tags[0],
|
|
75
|
+
start_time,
|
|
76
|
+
end_time,
|
|
77
|
+
num_points=3
|
|
78
|
+
)
|
|
79
|
+
self.assertIsInstance(result, list)
|
|
80
|
+
self.assertEqual(len(result), 3)
|
|
81
|
+
|
|
82
|
+
def test_get_interpolated_range_single_point(self):
|
|
83
|
+
"""Test getting interpolated range with single point"""
|
|
84
|
+
end_time = datetime.now()
|
|
85
|
+
start_time = end_time - timedelta(hours=24)
|
|
86
|
+
|
|
87
|
+
result = self.historian.getInterpolatedRange(
|
|
88
|
+
self.test_tags[0],
|
|
89
|
+
start_time,
|
|
90
|
+
end_time,
|
|
91
|
+
num_points=1
|
|
92
|
+
)
|
|
93
|
+
self.assertIsInstance(result, list)
|
|
94
|
+
self.assertEqual(len(result), 1)
|
|
95
|
+
self.assertValidDataPoint(result[0])
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
if __name__ == '__main__':
|
|
99
|
+
unittest.main()
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Test getMetaData function from historian module
|
|
3
|
+
"""
|
|
4
|
+
import sys
|
|
5
|
+
import os
|
|
6
|
+
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '../../')))
|
|
7
|
+
|
|
8
|
+
from tests.common import BaseHistorianTest
|
|
9
|
+
import unittest
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class TestGetMetaData(BaseHistorianTest):
|
|
13
|
+
"""Test cases for getMetaData function"""
|
|
14
|
+
|
|
15
|
+
def test_get_metadata_single_tag(self):
|
|
16
|
+
"""Test getting metadata for single tag"""
|
|
17
|
+
result = self.historian.getMetaData(self.test_tags[0])
|
|
18
|
+
self.assertIsInstance(result, (dict, list))
|
|
19
|
+
|
|
20
|
+
def test_get_metadata_multiple_tags(self):
|
|
21
|
+
"""Test getting metadata for multiple tags"""
|
|
22
|
+
result = self.historian.getMetaData(self.test_tags)
|
|
23
|
+
self.assertIsInstance(result, (dict, list))
|
|
24
|
+
|
|
25
|
+
def test_get_metadata_with_json_output(self):
|
|
26
|
+
"""Test getting metadata with json output"""
|
|
27
|
+
result = self.historian.getMetaData(self.test_tags[0], output="json")
|
|
28
|
+
self.assertIsInstance(result, (dict, list))
|
|
29
|
+
|
|
30
|
+
def test_get_metadata_nonexistent_tag(self):
|
|
31
|
+
"""Test getting metadata for non-existent tag"""
|
|
32
|
+
# This might raise an exception or return empty result depending on implementation
|
|
33
|
+
try:
|
|
34
|
+
result = self.historian.getMetaData("NONEXISTENT_TAG_12345")
|
|
35
|
+
self.assertIsInstance(result, (dict, list))
|
|
36
|
+
except Exception:
|
|
37
|
+
# Expected behavior for non-existent tags
|
|
38
|
+
pass
|
|
39
|
+
|
|
40
|
+
def test_get_metadata_calc_tag(self):
|
|
41
|
+
"""Test getting metadata for calculation tag"""
|
|
42
|
+
result = self.historian.getMetaData(self.calc_tag)
|
|
43
|
+
self.assertIsInstance(result, (dict, list))
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
if __name__ == '__main__':
|
|
47
|
+
unittest.main()
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Test getRawDataPoints function from historian module
|
|
3
|
+
"""
|
|
4
|
+
import sys
|
|
5
|
+
import os
|
|
6
|
+
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '../../')))
|
|
7
|
+
|
|
8
|
+
from tests.common import BaseHistorianTest
|
|
9
|
+
import unittest
|
|
10
|
+
from datetime import datetime, timedelta
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class TestGetRawDataPoints(BaseHistorianTest):
|
|
14
|
+
"""Test cases for getRawDataPoints function"""
|
|
15
|
+
|
|
16
|
+
def test_get_raw_single_tag(self):
|
|
17
|
+
"""Test getting raw data points for single tag"""
|
|
18
|
+
end_time = datetime.now()
|
|
19
|
+
start_time = end_time - timedelta(hours=24)
|
|
20
|
+
|
|
21
|
+
result = self.historian.getRawDataPoints(
|
|
22
|
+
self.test_tags[0],
|
|
23
|
+
start_time,
|
|
24
|
+
end_time,
|
|
25
|
+
maxpoints=10
|
|
26
|
+
)
|
|
27
|
+
self.assertIsInstance(result, list)
|
|
28
|
+
for dp in result:
|
|
29
|
+
self.assertValidDataPoint(dp)
|
|
30
|
+
|
|
31
|
+
def test_get_raw_multiple_tags(self):
|
|
32
|
+
"""Test getting raw data points for multiple tags"""
|
|
33
|
+
end_time = datetime.now()
|
|
34
|
+
start_time = end_time - timedelta(hours=24)
|
|
35
|
+
|
|
36
|
+
result = self.historian.getRawDataPoints(
|
|
37
|
+
self.test_tags,
|
|
38
|
+
start_time,
|
|
39
|
+
end_time,
|
|
40
|
+
maxpoints=10
|
|
41
|
+
)
|
|
42
|
+
self.assertIsInstance(result, list)
|
|
43
|
+
for dp in result:
|
|
44
|
+
self.assertValidDataPoint(dp)
|
|
45
|
+
|
|
46
|
+
def test_get_raw_with_json_output(self):
|
|
47
|
+
"""Test getting raw data points with json output"""
|
|
48
|
+
end_time = datetime.now()
|
|
49
|
+
start_time = end_time - timedelta(hours=24)
|
|
50
|
+
|
|
51
|
+
result = self.historian.getRawDataPoints(
|
|
52
|
+
self.test_tags[0],
|
|
53
|
+
start_time,
|
|
54
|
+
end_time,
|
|
55
|
+
maxpoints=10,
|
|
56
|
+
output="json"
|
|
57
|
+
)
|
|
58
|
+
self.assertIsInstance(result, list)
|
|
59
|
+
for dp in result:
|
|
60
|
+
self.assertValidDataPoint(dp)
|
|
61
|
+
|
|
62
|
+
def test_get_raw_with_epoch_times(self):
|
|
63
|
+
"""Test getting raw data points with epoch timestamps"""
|
|
64
|
+
end_time = 1714525200 + 3600 # May 1, 2024 3:00:00 AM
|
|
65
|
+
start_time = 1714525200 # May 1, 2024 2:00:00 AM
|
|
66
|
+
|
|
67
|
+
result = self.historian.getRawDataPoints(
|
|
68
|
+
self.test_tags[0],
|
|
69
|
+
start_time,
|
|
70
|
+
end_time,
|
|
71
|
+
maxpoints=10
|
|
72
|
+
)
|
|
73
|
+
self.assertIsInstance(result, list)
|
|
74
|
+
|
|
75
|
+
def test_get_raw_with_limit(self):
|
|
76
|
+
"""Test getting raw data points with maxpoints limit"""
|
|
77
|
+
end_time = datetime.now()
|
|
78
|
+
start_time = end_time - timedelta(days=1)
|
|
79
|
+
max_points = 5
|
|
80
|
+
|
|
81
|
+
result = self.historian.getRawDataPoints(
|
|
82
|
+
self.test_tags[0],
|
|
83
|
+
start_time,
|
|
84
|
+
end_time,
|
|
85
|
+
maxpoints=max_points
|
|
86
|
+
)
|
|
87
|
+
self.assertIsInstance(result, list)
|
|
88
|
+
self.assertLessEqual(len(result), max_points)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
if __name__ == '__main__':
|
|
92
|
+
unittest.main()
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Test listDataTags function from historian module
|
|
3
|
+
"""
|
|
4
|
+
import sys
|
|
5
|
+
import os
|
|
6
|
+
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '../../')))
|
|
7
|
+
|
|
8
|
+
from tests.common import BaseHistorianTest
|
|
9
|
+
import unittest
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class TestListDataTags(BaseHistorianTest):
|
|
13
|
+
"""Test cases for listDataTags function"""
|
|
14
|
+
|
|
15
|
+
def test_list_data_tags_no_wildcard(self):
|
|
16
|
+
"""Test listing data tags without wildcard"""
|
|
17
|
+
result = self.historian.listDataTags("")
|
|
18
|
+
self.assertIsInstance(result, list)
|
|
19
|
+
self.assertGreater(len(result), 0)
|
|
20
|
+
|
|
21
|
+
def test_list_data_tags_with_wildcard(self):
|
|
22
|
+
"""Test listing data tags with wildcard pattern"""
|
|
23
|
+
result = self.historian.listDataTags("*TI*")
|
|
24
|
+
self.assertIsInstance(result, list)
|
|
25
|
+
# Check that all returned tags contain "TI"
|
|
26
|
+
for tag in result:
|
|
27
|
+
self.assertIn("TI", tag)
|
|
28
|
+
|
|
29
|
+
def test_list_data_tags_specific_pattern(self):
|
|
30
|
+
"""Test listing data tags with specific pattern"""
|
|
31
|
+
result = self.historian.listDataTags("DEMO_02TI301*")
|
|
32
|
+
self.assertIsInstance(result, list)
|
|
33
|
+
# Should find the test tag
|
|
34
|
+
tag_found = any("DEMO_02TI301" in tag for tag in result)
|
|
35
|
+
self.assertTrue(tag_found)
|
|
36
|
+
|
|
37
|
+
def test_list_data_tags_no_matches(self):
|
|
38
|
+
"""Test listing data tags with pattern that has no matches"""
|
|
39
|
+
result = self.historian.listDataTags("NONEXISTENT_PATTERN_12345")
|
|
40
|
+
self.assertIsInstance(result, list)
|
|
41
|
+
# May be empty or may return empty list depending on implementation
|
|
42
|
+
|
|
43
|
+
def test_list_data_tags_empty_pattern(self):
|
|
44
|
+
"""Test listing data tags with empty pattern"""
|
|
45
|
+
result = self.historian.listDataTags("")
|
|
46
|
+
self.assertIsInstance(result, list)
|
|
47
|
+
# Should return all available tags
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
if __name__ == '__main__':
|
|
51
|
+
unittest.main()
|