mirror of https://github.com/vacp2p/wakurtosis.git
Fixed imports in wls tests
This commit is contained in:
parent
e923795552
commit
ca73887361
|
@ -1,14 +1,18 @@
|
|||
# Python Imports
|
||||
import unittest
|
||||
import random
|
||||
from unittest.mock import mock_open, patch
|
||||
|
||||
# Project Imports
|
||||
from src import wls
|
||||
|
||||
random.seed(0)
|
||||
|
||||
|
||||
class TestWLS(unittest.TestCase):
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
random.seed(1)
|
||||
|
||||
def create_patch(self, name):
|
||||
patcher = patch(name)
|
||||
thing = patcher.start()
|
||||
|
@ -178,8 +182,8 @@ class TestWLS(unittest.TestCase):
|
|||
|
||||
emitter_address, topic = wls._select_emitter_with_topic(emitters)
|
||||
|
||||
self.assertEqual(emitter_address, "http://5:6/")
|
||||
self.assertEqual(topic, "test2b")
|
||||
self.assertEqual(emitter_address, "http://1:2/")
|
||||
self.assertEqual(topic, "test1a")
|
||||
|
||||
def test__inject_message(self):
|
||||
mock_dist = self.create_patch('src.utils.payloads.make_payload_dist')
|
||||
|
|
|
@ -1,29 +1,31 @@
|
|||
# Python Imports
|
||||
import json
|
||||
import unittest
|
||||
import os
|
||||
|
||||
# Project Imports
|
||||
from src.utils import files
|
||||
|
||||
|
||||
class TestFiles(unittest.TestCase):
|
||||
|
||||
def test_load_config_file(self):
|
||||
config = files.load_config_file("test_files/test_config.json")
|
||||
config = files.load_config_file("src/utils/tests/test_files/test_config.json")
|
||||
self.assertEqual(config["general"]["prng_seed"], 1234)
|
||||
self.assertEqual(config["kurtosis"]["enclave_name"], "test")
|
||||
|
||||
def test_config_file_error(self):
|
||||
with self.assertRaises(FileNotFoundError):
|
||||
files.load_config_file("test_files/test_config_error.json")
|
||||
files.load_config_file("src/utils/tests/test_files/test_config_error.json")
|
||||
|
||||
def test_load_topology(self):
|
||||
test_topology = files.load_topology("test_files/test_topology.json")
|
||||
test_topology = files.load_topology("src/utils/tests/test_files/test_topology.json")
|
||||
self.assertEqual(test_topology["containers"]["containers_0"][0], "node_0")
|
||||
self.assertEqual(test_topology["nodes"]["node_0"]["image"], "nim-waku")
|
||||
|
||||
def test_load_topology_error(self):
|
||||
with self.assertRaises(FileNotFoundError):
|
||||
files.load_topology("test_files/test_topology_error.json")
|
||||
files.load_topology("src/utils/tests/test_files/test_topology_error.json")
|
||||
|
||||
def test_save_messages_to_json(self):
|
||||
msgs_dict = {"test": "test"}
|
||||
|
|
|
@ -1,14 +1,18 @@
|
|||
# Python Imports
|
||||
import unittest
|
||||
import random
|
||||
from unittest.mock import patch
|
||||
import random
|
||||
|
||||
# Project Imports
|
||||
from src.utils import payloads
|
||||
|
||||
random.seed(1)
|
||||
|
||||
|
||||
class TestPayloads(unittest.TestCase):
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
random.seed(1)
|
||||
|
||||
def create_patch(self, name):
|
||||
patcher = patch(name)
|
||||
thing = patcher.start()
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
# Python Imports
|
||||
import sys
|
||||
import logging
|
||||
|
||||
|
|
Loading…
Reference in New Issue