Unittest for Python-API

unittests Package

Unittests for gst-switch Python-API

test_connection_unit Module

Unittests for Connection class in connection.py

class unittests.test_connection_unit.MockConnection(method)[source]

Bases: object

A class which mocks the Connection class

call_sync(bus_name, object_path, interface_name, method_name, parameters, reply_type, flags, timeout_msec, cancellable)[source]

Mock of call_sync method, raises GLib.GError if interface_name invalid

funs = {'mark_tracking': None, 'get_audio_port': (4000,), 'click_video': (True,), 'adjust_pip': (1,), 'set_encode_mode': (False,), 'get_compose_port': (3001,), 'set_composite_mode': (False,), 'switch': (True,), 'mark_face': None, 'get_encode_port': (3002,), 'new_record': (False,), 'get_preview_ports': ('[(3002, 1, 7), (3003, 1, 8)]',)}
class unittests.test_connection_unit.TestAddress[source]

Bases: object

Unittests for address parameter

test_address_colon()[source]

Test if address has no colon

test_address_normal()[source]

“Test if address is valid

test_address_null()[source]

Test if address is null

class unittests.test_connection_unit.TestBusName[source]

Bases: object

Unittests for bus_name parameter

test_normal()[source]

Test if bus_name is not null

test_normal_none()[source]

Test if bus_name is null

class unittests.test_connection_unit.TestConnectDBus[source]

Bases: object

Unittests for the connect_dbus method of Connection class

test_bad_address()[source]

Test if wrong address is given - 1

test_bad_address2()[source]

Test if wrong address is given - 2

test_bad_address3()[source]

Test if wrong address is given - 3

test_mock1(monkeypatch)[source]

Test GLib.GError exception

test_mock2(monkeypatch)[source]

Test GLib.GError exception

class unittests.test_connection_unit.TestInterface[source]

Bases: object

Unittests for default_interface parameter

test_interface_dot()[source]

Test when the default_interface has <2 dots

test_interface_none()[source]

Test if default_interface is null

test_interface_normal()[source]

Test if default_interface is valid

class unittests.test_connection_unit.TestObjectPath[source]

Bases: object

Unittests for object_path parameter

test_object_path_blank()[source]

Test if object_path is null

test_object_path_normal()[source]

Test of object_path is valid

test_object_path_slash()[source]

Test when object_path doesn’t have slash in start

unittests.test_connection_unit.test_adjust_pip()[source]

Test the adjust_pip method

unittests.test_connection_unit.test_click_video()[source]

Test the click_video method

unittests.test_connection_unit.test_get_audio_port()[source]

Test the get_audio_port method

unittests.test_connection_unit.test_get_compose_port()[source]

Test the get_compose_port method

unittests.test_connection_unit.test_get_encode_port()[source]

Test the get_encode_port method

unittests.test_connection_unit.test_get_preview_ports()[source]

Test the get_preview_ports method

unittests.test_connection_unit.test_mark_face()[source]

Test the mark_face method

unittests.test_connection_unit.test_mark_tracking()[source]

Test the mark_tracking method

unittests.test_connection_unit.test_new_record()[source]

Test the new_record method

unittests.test_connection_unit.test_set_composite_mode()[source]

Test the set_composite_mode method

unittests.test_connection_unit.test_set_encode_mode()[source]

Test the set_encode_mode method

unittests.test_connection_unit.test_switch()[source]

Test the switch method

test_controller_unit Module

Unittests for Controller class in controller.py

class unittests.test_controller_unit.MockConnection(mode)[source]

Bases: object

A class which mocks the Connection class

adjust_pip(xpos, ypos, width, height)[source]

mock of adjust_pip

click_video(xpos, ypos, width, height)[source]

mock of click_video

get_audio_port()[source]

mock of get_audio_port

get_compose_port()[source]

mock of get_compose_port

get_encode_port()[source]

mock of get_encode_port

get_preview_ports()[source]

mock of get_preview_ports

mark_face(face)[source]

mock of mark_face

mark_tracking(face)[source]

mock of mark_tracking

new_record()[source]

mock of new_record

set_composite_mode(mode)[source]

mock of set_composite_mode

set_encode_mode(mode)[source]

mock of get_set_encode_mode

switch(channel, port)[source]

mock of switch

class unittests.test_controller_unit.TestAddress[source]

Bases: object

Test the address parameter

test_address_colon()[source]

Test if address has no colon

test_address_normal()[source]

Test if address is valid

test_address_null()[source]

Test if address is null

class unittests.test_controller_unit.TestAdjustPIP[source]

Bases: object

Test the adjust_pip method

test_normal_unpack()[source]

Test if valid

test_unpack()[source]

Test if unpack fails

class unittests.test_controller_unit.TestBusName[source]

Bases: object

Test bus_name parameter

test_normal()[source]

Test when bus_name is not null

test_normal_none()[source]

Test when bus_name is null

class unittests.test_controller_unit.TestClickVideo[source]

Bases: object

Test the click_video method

test_normal_unpack()[source]

Test if valid

test_unpack()[source]

Test if unpack fails

class unittests.test_controller_unit.TestEstablishConnection[source]

Bases: object

Test the establish_connection method

test_normal(monkeypatch)[source]

Test if the parameters are valid

class unittests.test_controller_unit.TestGetAudioPort[source]

Bases: object

Test the get_audio_port method

test_normal_unpack()[source]

Test if valid

test_unpack()[source]

Test if unpack fails

class unittests.test_controller_unit.TestGetComposePort[source]

Bases: object

Test the get_compose_port method

test_normal_unpack()[source]

Test when valid

test_unpack()[source]

Test when values cant unpack

class unittests.test_controller_unit.TestGetEncodePort[source]

Bases: object

Test the get_encode_port method

test_normal_unpack()[source]

Test if valid

test_unpack()[source]

Test if unpack fails

class unittests.test_controller_unit.TestGetPreviewPorts[source]

Bases: object

Test the get_preview_ports method

test_normal_unpack()[source]

Test if valid

test_unpack()[source]

Test if unpack fails

class unittests.test_controller_unit.TestInterface[source]

Bases: object

Test the default_interface parameter

test_interface_dot()[source]

Test when the default_interface has <2 dots

test_interface_none()[source]

Test when the default_interface is null

test_interface_normal()[source]

Test when the interface is valid

class unittests.test_controller_unit.TestMarkFaces[source]

Bases: object

Tes the mark_face method

test_normal()[source]

Test if valid

class unittests.test_controller_unit.TestMarkTracking[source]

Bases: object

Test the mark_tracking method

test_normal()[source]

Test if valid

class unittests.test_controller_unit.TestNewRecord[source]

Bases: object

Test the new_record method

test_normal_unpack()[source]

Test if valid

test_unpack()[source]

Test if unpack fails

class unittests.test_controller_unit.TestObjectPath[source]

Bases: object

Test object_path parameter

test_object_path_blank()[source]

Test when the object_path is null

test_object_path_normal()[source]

Test when object_path is valid

test_object_path_slash()[source]

Test when object_path doesn’t have slash in start

class unittests.test_controller_unit.TestParsePreviewPorts[source]

Bases: object

Test the parse_preview_ports class method

test_normal()[source]

Test if valid

test_syntax_error()[source]

Test if syntax error detected

test_value_error()[source]

Test if invalid

class unittests.test_controller_unit.TestSetCompositeMode[source]

Bases: object

Test the set_composite_mode method

test_normal_unpack()[source]

Test if valid

test_unpack()[source]

Test if unpack fails

class unittests.test_controller_unit.TestSetEncodeMode[source]

Bases: object

Test the set_encode_mode method

test_normal_unpack()[source]

Test if valid

test_unpack()[source]

Test if unpack fails

class unittests.test_controller_unit.TestSwitch[source]

Bases: object

Test the switch method

test_normal_unpack()[source]

Test if valid

test_unpack()[source]

Test if unpack fails

test_helpers_unit Module

Unittests for helper.py

class unittests.test_helpers_unit.TestPreviewSinks[source]

Bases: object

Test Preview Sinks

class MockPreview(preview_port=3001)[source]

Bases: object

A mock preview class

end()[source]

End the preview

run()[source]

Run the preview

TestPreviewSinks.test_run(monkeypatch)[source]

Test running preview

TestPreviewSinks.test_terminate_fail()[source]

Test terminating a preview when none exists

TestPreviewSinks.test_terminate_normal(monkeypatch)[source]

Test terminating a preview when valid exists

class unittests.test_helpers_unit.TestPreviewSinksPreviewPort[source]

Bases: object

Test preview_port parameter

test_blank()[source]

Test when preview_port is blank

test_invalid()[source]

Test when preview_port is not a integral value

test_normal()[source]

Test when preview_port is valid

test_range()[source]

Test when preview_port is out of range

class unittests.test_helpers_unit.TestTestSources[source]

Bases: object

Test for testsources

class MockAudioSrc(port, freq=110, wave=None)[source]

Bases: object

A Mock audio source

run()[source]

Run the source

class TestTestSources.MockTest(pattern)[source]

Bases: object

A mock test

end()[source]

End the test

class TestTestSources.MockTest2(wave)[source]

Bases: object

A mock audio source

end()[source]

End the source

class TestTestSources.MockVideoSrc(port, width=300, height=200, pattern=None, timeoverlay=False, clockoverlay=False)[source]

Bases: object

A mock video source

run()[source]

Run the mock video source

TestTestSources.test_get_test_audio()[source]

Test get_test_audio

TestTestSources.test_get_test_video()[source]

Test for get_test_video

TestTestSources.test_new_test_audio(monkeypatch)[source]

Test new_test_audio

TestTestSources.test_new_test_video(monkeypatch)[source]

Test for new_test_video

TestTestSources.test_terminate1_audio()[source]

Test terminate_audio multiple

TestTestSources.test_terminate1_video()[source]

Test terminate_video multiple

TestTestSources.test_terminate2_audio()[source]

Test terminate_audio none present

TestTestSources.test_terminate2_video()[source]

Test terminate_video none present

TestTestSources.test_terminate_index_error_audio()[source]

Test terminate_index_audio - invalid index

TestTestSources.test_terminate_index_error_video()[source]

Test for terminate_video

TestTestSources.test_terminate_index_normal_audio()[source]

Test terminate_index_audio valid index

TestTestSources.test_terminate_index_normal_video()[source]

Test terminate_index_video

class unittests.test_helpers_unit.TestTestSourcesAudioPort[source]

Bases: object

Test for audio_port parameter

test_invalid()[source]

Test when not integral value

test_normal()[source]

Test when valid

test_range()[source]

Test when out of range

class unittests.test_helpers_unit.TestTestSourcesVideoPort[source]

Bases: object

Test for video_port parameter

test_invalid()[source]

Test when not integral value

test_normal()[source]

Test when valid

test_range()[source]

Test when out of range

test_server_unit Module

Unittests for Server class in server.py

class unittests.test_server_unit.MockPopen(cmd, bufsize, shell)[source]

Bases: object

Mock Popen method

communicate()[source]

Mock communicate method of Popen

class unittests.test_server_unit.MockProcess(mode=True)[source]

Bases: object

A mock process

kill()[source]

Kill the mock process

make_coverage()[source]

Dump coverage

terminate()[source]

Terminate the mock process

class unittests.test_server_unit.TestAudioPort[source]

Bases: object

Test for audio_port parameter

test_invalid_audio_port_null()[source]

Test when the audio_port is null

test_invalid_audio_port_range()[source]

Test when the audio port is not in range

test_invalid_audio_port_type()[source]

Test when the audio port given is not a valid integral value

class unittests.test_server_unit.TestControlPort[source]

Bases: object

Test the control_port parameter

test_invalid_control_port_null()[source]

Test when the control port is null

test_invalid_control_port_range()[source]

Test when the control port is not in range

test_invalid_control_port_type()[source]

Test when the control port is not a valid integral value

class unittests.test_server_unit.TestKillTerminate[source]

Bases: object

Test kill, terminate and gcov_flush methods

test_gcov_flush_fail()[source]

Test when gcov_flush fails

test_kill_fail()[source]

Test when kill fails

test_no_process_gov_flush()[source]

Test when no process exists and gcov_flush is called

test_no_process_kill()[source]

Test when no process exists and kill is called

test_no_process_terminate()[source]

Test when no process exists and terminate is called

test_terminate_fail()[source]

Test when terminate fails

class unittests.test_server_unit.TestNormal[source]

Bases: object

Test the functioning of tests under valid conditions

test_kill(monkeypatch)[source]

Test kill ServerProcessError

test_kill_cov(monkeypatch)[source]

Test kill and gcov_flush ServerProcessError

test_make_coverage(monkeypatch)[source]

Test dumping coverage

test_normal_gcov_flush(monkeypatch)[source]

Test gcov_flush

test_normal_kill(monkeypatch)[source]

Test kill when normally called

test_normal_terminate()[source]

Test terminal when normally called

test_terminate()[source]

Test terminate ServerProcessError

test_terminate_cov()[source]

Test terminate and gcov_flush ServerProcessError

class unittests.test_server_unit.TestPath[source]

Bases: object

Test the path parameter

test_path_empty(monkeypatch)[source]

Test if null path is given

test_path_provided_no_slash()[source]

Test if a path is provided

test_path_provided_slash()[source]

Test if a path is provided

class unittests.test_server_unit.TestRecordFile[source]

Bases: object

Test the record_file parameter

test_record_file_false()[source]

Test if record file is False

test_record_file_invalid()[source]

Test when the record_file is invalid

test_record_file_slashes()[source]

Test when the record_file has forward slashes

test_record_file_true()[source]

Test if record file is True

test_record_file_valid()[source]

Test if record file is valid

test_record_file_valid_date()[source]

Test if record file is valid

test_record_file_valid_space()[source]

Test if record file is valid and has a space

class unittests.test_server_unit.TestRun[source]

Bases: object

Test running the server

test_run()[source]

Test the run method

test_run_process()[source]

Test _run_process method

test_start_process_error(monkeypatch)[source]

Test _start_process method

test_start_process_normal(monkeypatch)[source]

Test _start_process normally

class unittests.test_server_unit.TestVideoPort[source]

Bases: object

Test for video_port parameter

test_invalid_video_port_null()[source]

Test when the video_port is null

test_invalid_video_port_range()[source]

Test when the video port is not in range

test_invalid_video_port_type()[source]

Test when the video port given is not a valid integral value

test_testsource_unit Module

Unitests for testsource.py

class unittests.test_testsource_unit.MockPipeline[source]

Bases: object

Mock Pipeline

disable()[source]

Disable the pipeline

pause()[source]

Pause the pipeline

play()[source]

Play the pipeline

class unittests.test_testsource_unit.TestAudioSrcFreq[source]

Bases: object

Test frequency parameter

test_blank()[source]

Test when frequency is null

test_invalid()[source]

Test when frequency is not a valid integral value

test_normal()[source]

Test when frequency is valid

test_range()[source]

Test when frequency is not in range (negative)

class unittests.test_testsource_unit.TestAudioSrcPlay[source]

Bases: object

Test Audio Source options - play, pause, end

test_end()[source]

End the audio source

test_pause()[source]

Pause the audio source

test_run()[source]

Run the audio source

class unittests.test_testsource_unit.TestAudioSrcPort[source]

Bases: object

Test port parameter

test_blank()[source]

Test when port is null

test_invalid()[source]

Test when port is not a valid integral value

test_normal()[source]

Test when port is valid

test_range()[source]

Test when port is not in range

class unittests.test_testsource_unit.TestAudioSrcWave[source]

Bases: object

Test wave parameter

test_invalid()[source]

Test when wave is not a valid integral value

test_normal()[source]

Test when wave is valid

test_range()[source]

Test when wave is not in range

class unittests.test_testsource_unit.TestBasePipeline[source]

Bases: object

Test Base Pipeline

test_disable(monkeypatch)[source]

Test disable method

test_pause(monkeypatch)[source]

Test pause method

test_play(monkeypatch)[source]

Test play method

class unittests.test_testsource_unit.TestPreviewPlay[source]

Bases: object

Test preview options - play, pause, end

test_end()[source]

Test end method

test_pause()[source]

Test pause method

test_run()[source]

Test play method

class unittests.test_testsource_unit.TestPreviewPort[source]

Bases: object

Test port parameter

test_blank()[source]

Test when port is null

test_invalid()[source]

Test when port is not a valid integral value

test_normal()[source]

Test when port is valid

test_range()[source]

Test when port is not in range

class unittests.test_testsource_unit.TestVideoPipeline[source]

Bases: object

Test VideoPipeline

test_permuate_time_clock_1()[source]

Test when timeoverlay False and clockoverlay False

test_permuate_time_clock_2()[source]

test when timeoverlay False and clockoverlay True

test_permuate_time_clock_3()[source]

Test when timeoverlay True and clockoverlay False

test_permuate_time_clock_4()[source]

Test when timeoverlay True and clockoverlay True

class unittests.test_testsource_unit.TestVideoSrcClockOverlay[source]

Bases: object

Test clockoverlay pattern

test_fail()[source]

Test when clockoverlay is not boolean/valid

test_normal()[source]

Test when clockoverlay is valid

class unittests.test_testsource_unit.TestVideoSrcHeight[source]

Bases: object

Test for height parameter

test_blank()[source]

Test when the height is a null

test_invalid()[source]

Test when height is not a valid float value

test_non_positive()[source]

Test when heightis non-positive

test_normal()[source]

Test when height is valid

class unittests.test_testsource_unit.TestVideoSrcPattern[source]

Bases: object

Test the pattern parameter

test_invalid()[source]

Test when pattern is not a valid integer

test_normal()[source]

Test when pattern is valid

test_range()[source]

Test when pattern is not in range

class unittests.test_testsource_unit.TestVideoSrcPlay[source]

Bases: object

Test Video Source options - play, pause, disable

test_end()[source]

Test end method

test_pause()[source]

Test pause method

test_run()[source]

Test run method

class unittests.test_testsource_unit.TestVideoSrcPort[source]

Bases: object

Test the port parameter

test_blank()[source]

Test when the port is null

test_invalid()[source]

Test when the port is not a valid integral value

test_normal()[source]

Test when port is a valid value

test_range()[source]

Test when the port is not in range

class unittests.test_testsource_unit.TestVideoSrcTimeOverlay[source]

Bases: object

Test timeoverlay parameter

test_fail()[source]

Test when timeoverlay is not boolean/valid

test_normal()[source]

Test when timeoverlay is valid

class unittests.test_testsource_unit.TestVideoSrcWidth[source]

Bases: object

Test the width parameter

test_blank()[source]

Test when the width is null

test_invalid()[source]

Test when the width is not a valid float value

test_non_positive()[source]

Test when the width is non-positive

test_normal()[source]

Test when the width is valid