コード例 #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)