예제 #1
0
def test_set_location_should_fail_for_non_numeric_longitude():
    lat = 4.212332
    lon = 'B2'
    elev = 0.0

    with pytest.raises(ValueError):
        LPGAN_API_Tx.set_location(lat, lon, elev)
예제 #2
0
def test_set_location_should_fail_for_non_numeric_elevation():
    lon = 62.33232
    lat = 4.212332
    elev = 'C1'

    with pytest.raises(ValueError):
        LPGAN_API_Tx.set_location(lat, lon, elev)
예제 #3
0
def test_set_location_should_create_valid_string():
    lat = 52.333233
    lon = 4.212332
    elev = 0.0

    expected_string = f'set_location(\"{lat}\",\"{lon}\",\"{elev}\")\r\n'

    assert expected_string == LPGAN_API_Tx.set_location(lat, lon, elev)
예제 #4
0
def test_set_modem_number_should_create_valid_string():
    modem_number = 'ABCD 1234'
    expected_string = f'set_modem_number({modem_number})\r\n'
    assert expected_string == LPGAN_API_Tx.set_modem_number(modem_number)
예제 #5
0
def test_get_modem_info_should_create_valid_string():
    assert 'get_modem_info\r\n' == LPGAN_API_Tx.get_modem_info()
예제 #6
0
def test_get_firmware_version_should_create_valid_string():
    assert 'get_firmware_version\r\n' == LPGAN_API_Tx.get_firmware_version()
예제 #7
0
def test_do_gps_fix_with_input_int_instead_of_string_should_fail():
    input_value = 1234.5

    with pytest.raises(ValueError):
        LPGAN_API_Tx.do_gps_fix(input_value)
예제 #8
0
def test_set_datetime_should_fail_for_non_datetime_value_input():
    with pytest.raises(ValueError):
        LPGAN_API_Tx.set_datetime(2019)
예제 #9
0
def test_set_gps_mode_return_valid_string():
    l = LPGAN_API_Tx()

    expected_string = 'set_gps_mode(true)\r\n'

    assert expected_string == l.set_gps_mode(True)
예제 #10
0
def test_get_location_should_create_valid_string():
    assert 'get_location\r\n' == LPGAN_API_Tx.get_location()
예제 #11
0
def test_set_payload_fails_for_non_integer_input():
    payload_length = 20.1
    with pytest.raises(ValueError):
        LPGAN_API_Tx.set_payload(payload_length)
예제 #12
0
def test_set_payload_should_create_a_valid_string():
    payload_length = 20
    assert 'set_payload(\"20\")\r\n' == LPGAN_API_Tx.set_payload(
        payload_length)
예제 #13
0
def test_toggle_payload_over_debug_should_fail_for_non_boolean_input():
    with pytest.raises(ValueError):
        LPGAN_API_Tx.toggle_payload_over_debug(1)
예제 #14
0
def test_toggle_payload_over_debug_should_create_valid_string():
    assert 'toggle_payload_over_debug(true)\r\n' == LPGAN_API_Tx.toggle_payload_over_debug(
        True)
예제 #15
0
def test_go_to_sleep_should_create_a_valid_string():
    assert 'go_to_sleep\r\n' == LPGAN_API_Tx.go_to_sleep()
예제 #16
0
def test_get_next_pass_should_create_a_valid_string():
    assert 'get_next_pass\r\n' == LPGAN_API_Tx.get_next_pass()
예제 #17
0
def test_get_next_alarm_should_create_valid_string():
    assert 'get_next_alarm\r\n' == LPGAN_API_Tx.get_next_alarm()
예제 #18
0
def test_set_modem_number_fails_if_non_string_passed():
    modem_number = 12345678
    with pytest.raises(ValueError):
        LPGAN_API_Tx.set_modem_number(modem_number)
예제 #19
0
def test_set_modem_number_should_fail_for_invalid_string_missing_middle_space(
):
    modem_number = 'ABCD1234'
    with pytest.raises(ValueError):
        LPGAN_API_Tx.set_modem_number(modem_number)
예제 #20
0
def test_set_gps_mode_raise_exception_for_non_boolean():
    with pytest.raises(ValueError):
        LPGAN_API_Tx.set_gps_mode('Failure')
예제 #21
0
def test_get_datetime_should_create_valid_string():
    assert 'get_datetime\r\n' == LPGAN_API_Tx.get_datetime()
예제 #22
0
def test_do_gps_fix_with_input_string():
    input_string = '12345,223452'
    expected_string = f'do_gps_fix(\"{input_string}\")\r\n'

    assert expected_string == LPGAN_API_Tx.do_gps_fix(input_string)
예제 #23
0
def test_do_gps_fix_no_input_string():
    expected_string = 'do_gps_fix\r\n'

    assert expected_string == LPGAN_API_Tx.do_gps_fix()
예제 #24
0
def test_set_datetime_should_create_valid_string():
    d = dt.datetime(year=2019, month=10, day=25, hour=10, minute=59, second=48)
    assert 'set_datetime(\"2019-10-25T10:59:48Z\")\r\n' == LPGAN_API_Tx.set_datetime(
        d)