def test_fail_db_port(self): copy = {**os.environ} del copy['DB_PORT'] with patch.dict('os.environ', copy, clear=True): self.assertFalse(db.db_env_defined())
# Standard library imports import unittest from unittest.mock import MagicMock from datetime import datetime import simplejson as json import os import random import logging from datetime import datetime from pyvvo import app, db, equipment, ga, glm, sparql, utils from tests.models import IEEE_9500 import tests.data_files as _df # See if we have database inputs defined. DB_ENVIRON_PRESENT = db.db_env_defined() class UpdateInverterStateInGLMTestCase(unittest.TestCase): """Test _update_inverter_state_in_glm.""" def test_9500(self): """Just ensure the method runs for the 9500 node model.""" # Read inverter data. inverter_df = _df.read_pickle(_df.INVERTERS_9500) inverters = equipment.initialize_inverters(inverter_df) # Initialize a GLMManager. glm_mgr = glm.GLMManager(model=IEEE_9500, model_is_path=True) with self.assertLogs(app.LOG, 'INFO') as cm: app._update_inverter_state_in_glm(glm_mgr=glm_mgr,
def test_works(self): """This should work out of the box.""" self.assertTrue(db.db_env_defined())