Example #1
0
def test_weather(test_file, out_file):
    result = edit_miz(test_file, out_file, metar=METAR)
    assert not result
    with NewMiz(out_file) as miz:
        assert miz.mission.weather.wind_at_ground_level_dir == 130
        assert miz.mission.weather.wind_at_ground_level_speed == 8
        assert miz.mission.weather.cloud_base == 300
        assert miz.mission.weather.cloud_density == 0
        assert miz.mission.weather.qnh == 759
        assert miz.mission.weather.precipitations == 0
Example #2
0
def test_zip_error(test_file, out_file):
    when(Miz).zip(...).thenRaise(OSError)
    assert edit_miz(test_file, out_file, time=TIME) == \
        f'permission error: cannot edit "{out_file}"; maybe it is in use ?'
    verifyStubbedInvocationsAreUsed()
Example #3
0
def test_apply_time_failed(test_file, out_file):
    when(emiz.mission_time.MissionTime).apply_to_miz(...).thenReturn(False)
    assert edit_miz(test_file, out_file,
                    time=TIME) == 'error while setting time on mission'
    verifyStubbedInvocationsAreUsed()
Example #4
0
def test_apply_metar_failed(test_file, out_file):
    when(emiz.weather.mission_weather.MissionWeather).apply_to_miz(
        ...).thenReturn(False)
    assert edit_miz(test_file, out_file,
                    metar=METAR) == 'error while applying METAR to mission'
    verifyStubbedInvocationsAreUsed()
Example #5
0
def test_bad_time_string(out_file):
    assert edit_miz(out_file,
                    time='plop') == 'badly formatted time string: plop'
Example #6
0
def test_metar_error(out_file):
    when(emiz.weather.custom_metar.CustomMetar).get_metar(...).thenReturn(
        ('error', None))
    assert edit_miz(out_file, metar='plop') == 'error'
    verifyStubbedInvocationsAreUsed()
Example #7
0
def test_nothing_to_do(out_file):
    assert edit_miz(out_file) == 'nothing to do!'
Example #8
0
def test_no_outfile(caplog, out_file):
    edit_miz(out_file)
    assert 'editing in place' in caplog.text
Example #9
0
def test_time(test_file, out_file):
    result = edit_miz(test_file, out_file, time=TIME)
    assert not result
    with NewMiz(out_file) as miz:
        assert miz.mission.mission_start_time_as_string == '22:50:00'
        assert miz.mission.mission_start_date_as_string == '01/02/2018'