Skip to content

RulesManager tests

This collection of tests, tests the RulesManager component.


The rules_tests module collects various tests of the RuleManager.

TestRulesManager

Test the Rules Manager.

setUpClass()

Setup the tests by creating a private directory in /tmp

Source code in tests/rules_tests.py
def setUpClass() :
  """
  Setup the tests by creating a private directory in /tmp
  """
  os.makedirs(os.path.join(cputilsTestDir, 'test01'), exist_ok=True)
  os.system("tree "+ cputilsTestDir)
  with open(os.path.join(cputilsTestDir, 'test01', 'silly.txt'), 'w') as f :
    f.write("This is a test")

tearDownClass()

Tear down the private directory in /tmp

Source code in tests/rules_tests.py
def tearDownClass() :
  """
  Tear down the private directory in /tmp
  """
  shutil.rmtree(cputilsTestDir)

test_loadRules(t)

When loading a rule set, we want to make sure that any new Artefact types are sent to the ArtefactManager via NATS.

Source code in tests/rules_tests.py
@unittest.skip("No real tests yet")
def test_loadRules(t) :
  """

  When loading a rule set, we want to make sure that any new Artefact
  types are sent to the ArtefactManager via NATS.

  """
  cputils.rulesManager.loadRules('../examples/rulesManager')

test_ruleManager(t) async

Test the RuleManager

Source code in tests/rules_tests.py
@asyncTestOfProcess()
async def test_ruleManager(t) :
  """
  Test the **RuleManager**
  """
  t.assertTrue(True)