Skip to content

Commit

Permalink
COE-892: test simulator script (#80)
Browse files Browse the repository at this point in the history
* COE-892: Add test to run simulator script

---------

Co-authored-by: Nam Nhat Pham <naph@softwareag.com>
  • Loading branch information
namnhatpham and Nam Nhat Pham committed Apr 19, 2023
1 parent 03b8f7b commit 6b4b0c7
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions test/export_import_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ def test_export_import_profile_data(self, mock_error):
device_id = Utils.create_device(self.device_model_with_events)
external_device_id = self.device_model_with_events.get('id')
profile_id = self.oee_api.create_and_activate_profile(external_id=external_device_id).get('id')

filename = f"{external_device_id}_profile"
data_file_path = f"export_data/{filename}.json"

Expand Down Expand Up @@ -98,7 +97,6 @@ def test_export_import_profile_data(self, mock_error):
# Check if the data file is empty
self.assertTrue(len(data.get('measurements')) > 0 or len(data.get('alarms')) > 0, msg=f"No data in {filename}.json")


finally:
# Change back to the original working directory
os.chdir(current_dir)
Expand Down Expand Up @@ -130,6 +128,14 @@ def set_time_period():
date_to = datetime_to_string(date_to)

return date_from, date_to
@staticmethod
def change_working_dir_between_extras_and_test():
base_dir = os.path.basename(os.getcwd())
# If the working directory is test then change to extras
if base_dir == "test":
os.chdir("../simulators/extras")
elif base_dir == "extras":
os.chdir("../../test")

@staticmethod
def change_working_dir_between_extras_and_test():
Expand Down

0 comments on commit 6b4b0c7

Please sign in to comment.