Skip to content

Commit

Permalink
Add tests for inspections
Browse files Browse the repository at this point in the history
  • Loading branch information
tsundvoll committed Nov 13, 2023
1 parent 6a43e0e commit 6b22308
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/isar_robot/inspections.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def create_thermal_video(step: TakeThermalVideo):
start_time=now,
pose=telemetry.get_pose(),
file_type="mp4",
duration=11,
duration=step.duration,
)
thermal_video_metadata.tag_id = step.tag_id
thermal_video_metadata.analysis_type = ["test1", "test2"]
Expand All @@ -117,7 +117,7 @@ def create_audio(step: RecordAudio):
start_time=now,
pose=telemetry.get_pose(),
file_type="wav",
duration=11,
duration=step.duration,
)
audio_metadata.tag_id = step.tag_id
audio_metadata.analysis_type = ["test1", "test2"]
Expand Down
47 changes: 44 additions & 3 deletions tests/test_inspections.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,52 @@
from alitra import Frame, Position
from robot_interface.models.mission.step import TakeImage
from robot_interface.models.mission.step import RecordAudio, TakeImage, TakeThermalVideo

from isar_robot import inspections

target = Position(x=0, y=0, z=0, frame=Frame("robot"))


def test_create_image():
target = Position(x=0, y=0, z=0, frame=Frame("robot"))
step = TakeImage(target=target)

inspections.create_image(step=step)
list_of_images = inspections.create_image(step)

assert len(list_of_images) == 1

inspection_image = list_of_images[0]
assert inspection_image.metadata.file_type == "jpg"


def test_create_video():
step = TakeImage(target=target)

list_of_videos = inspections.create_video(step)

assert len(list_of_videos) == 1

inspection_video = list_of_videos[0]
assert inspection_video.metadata.file_type == "mp4"


def test_create_thermal_video():
step = TakeThermalVideo(target=target, duration=10)

list_of_thermal_videos = inspections.create_thermal_video(step)

assert len(list_of_thermal_videos) == 1

inspection_video = list_of_thermal_videos[0]
assert inspection_video.metadata.file_type == "mp4"
assert inspection_video.metadata.duration == 10


def test_create_audio():
step = RecordAudio(target=target, duration=10)

list_of_audio_recordings = inspections.create_audio(step)

assert len(list_of_audio_recordings) == 1

inspection_recordings = list_of_audio_recordings[0]
assert inspection_recordings.metadata.file_type == "wav"
assert inspection_recordings.metadata.duration == 10

0 comments on commit 6b22308

Please sign in to comment.