コード例 #1
0
ファイル: e2e_tests.py プロジェクト: drewbare/tzupdate
def test_timeout_results_in_exception(process_mock):
    # The process mock causes us to never run get_timezone_from_ip, so we
    # should time out
    setup_basic_api_response()
    args = ['-s', '0.01']
    with assert_raises(tzupdate.TimezoneAcquisitionError):
        tzupdate.main(args, services=FAKE_SERVICES)
コード例 #2
0
ファイル: test_e2e.py プロジェクト: pshlos46/tzupdate
def test_explicit_ip(get_timezone_mock, _unused_ll, _unused_deb):
    ip_addr = "1.2.3.4"
    args = ["-a", ip_addr]
    tzupdate.main(args, services=FAKE_SERVICES)
    get_timezone_mock.assert_called_once_with(ip_addr,
                                              timeout=mock.ANY,
                                              services=FAKE_SERVICES)
コード例 #3
0
ファイル: e2e_tests.py プロジェクト: cdown/tzupdate
def test_timeout_results_in_exception(process_mock):
    # The process mock causes us to never run get_timezone_from_ip, so we
    # should time out
    setup_basic_api_response()
    args = ["-s", "0.01"]
    with assert_raises(tzupdate.TimezoneAcquisitionError):
        tzupdate.main(args, services=FAKE_SERVICES)
コード例 #4
0
ファイル: e2e_tests.py プロジェクト: cdown/tzupdate
def test_explicit_timezone(link_localtime_mock, deb_tz_mock):
    timezone = "Foo/Bar"
    args = ["-t", timezone]
    tzupdate.main(args)
    link_localtime_mock.assert_called_once_with(
        timezone, tzupdate.DEFAULT_ZONEINFO_PATH, tzupdate.DEFAULT_LOCALTIME_PATH
    )
    deb_tz_mock.assert_called_once_with(timezone, tzupdate.DEFAULT_DEBIAN_TIMEZONE_PATH)
コード例 #5
0
def test_end_to_end_no_args(link_localtime_mock, deb_tz_mock):
    setup_basic_api_response()
    args = []
    tzupdate.main(args, services=FAKE_SERVICES)
    link_localtime_mock.assert_called_once_with(
        FAKE_TIMEZONE, tzupdate.DEFAULT_ZONEINFO_PATH,
        tzupdate.DEFAULT_LOCALTIME_PATH)
    deb_tz_mock.assert_called_once_with(FAKE_TIMEZONE,
                                        tzupdate.DEFAULT_DEBIAN_TIMEZONE_PATH)
コード例 #6
0
def test_explicit_timezone(link_localtime_mock, deb_tz_mock):
    timezone = "Foo/Bar"
    args = ["-t", timezone]
    tzupdate.main(args)
    link_localtime_mock.assert_called_once_with(
        timezone, tzupdate.DEFAULT_ZONEINFO_PATH,
        tzupdate.DEFAULT_LOCALTIME_PATH)
    deb_tz_mock.assert_called_once_with(timezone,
                                        tzupdate.DEFAULT_DEBIAN_TIMEZONE_PATH)
コード例 #7
0
ファイル: e2e_tests.py プロジェクト: jbrockmendel/tzupdate
def test_explicit_timezone(link_localtime_mock):
    timezone = 'Foo/Bar'
    args = ['-t', timezone]
    tzupdate.main(args)
    assert_true(
        link_localtime_mock.called_once_with(
            timezone,
            tzupdate.DEFAULT_ZONEINFO_PATH, tzupdate.DEFAULT_LOCALTIME_PATH,
        )
    )
コード例 #8
0
ファイル: e2e_tests.py プロジェクト: cdown/tzupdate
def test_end_to_end_no_args(link_localtime_mock, deb_tz_mock):
    setup_basic_api_response()
    args = []
    tzupdate.main(args, services=FAKE_SERVICES)
    link_localtime_mock.assert_called_once_with(
        FAKE_TIMEZONE, tzupdate.DEFAULT_ZONEINFO_PATH, tzupdate.DEFAULT_LOCALTIME_PATH
    )
    deb_tz_mock.assert_called_once_with(
        FAKE_TIMEZONE, tzupdate.DEFAULT_DEBIAN_TIMEZONE_PATH
    )
コード例 #9
0
ファイル: test_e2e.py プロジェクト: pshlos46/tzupdate
def test_explicit_paths(link_localtime_mock, deb_tz_mock):
    setup_basic_api_response()
    localtime_path = "/l"
    zoneinfo_path = "/z"
    deb_path = "/d"
    args = ["-l", localtime_path, "-z", zoneinfo_path, "-d", deb_path]
    tzupdate.main(args, services=FAKE_SERVICES)
    link_localtime_mock.assert_called_once_with(FAKE_TIMEZONE, zoneinfo_path,
                                                localtime_path)
    deb_tz_mock.assert_called_once_with(FAKE_TIMEZONE, deb_path, True)
コード例 #10
0
ファイル: e2e_tests.py プロジェクト: whwright/tzupdate
def test_explicit_timezone(link_localtime_mock):
    timezone = 'Foo/Bar'
    args = ['-t', timezone]
    tzupdate.main(args)
    assert_true(
        link_localtime_mock.called_once_with(
            timezone,
            tzupdate.DEFAULT_ZONEINFO_PATH,
            tzupdate.DEFAULT_LOCALTIME_PATH,
        ))
コード例 #11
0
ファイル: e2e_tests.py プロジェクト: jbrockmendel/tzupdate
def test_explicit_paths(link_localtime_mock, get_timezone_for_ip_mock):
    localtime_path = '/l'
    zoneinfo_path = '/z'
    get_timezone_for_ip_mock.return_value = FAKE_TIMEZONE
    args = ['-l', localtime_path, '-z', zoneinfo_path]
    tzupdate.main(args)
    assert_true(
        link_localtime_mock.called_once_with(
            FAKE_TIMEZONE, zoneinfo_path, localtime_path,
        ),
    )
コード例 #12
0
ファイル: e2e_tests.py プロジェクト: cdown/tzupdate
def test_explicit_paths(link_localtime_mock, deb_tz_mock):
    setup_basic_api_response()
    localtime_path = "/l"
    zoneinfo_path = "/z"
    deb_path = "/d"
    args = ["-l", localtime_path, "-z", zoneinfo_path, "-d", deb_path]
    tzupdate.main(args, services=FAKE_SERVICES)
    link_localtime_mock.assert_called_once_with(
        FAKE_TIMEZONE, zoneinfo_path, localtime_path
    )
    deb_tz_mock.assert_called_once_with(FAKE_TIMEZONE, deb_path)
コード例 #13
0
ファイル: e2e_tests.py プロジェクト: whwright/tzupdate
def test_explicit_paths(link_localtime_mock, get_timezone_for_ip_mock):
    localtime_path = '/l'
    zoneinfo_path = '/z'
    get_timezone_for_ip_mock.return_value = FAKE_TIMEZONE
    args = ['-l', localtime_path, '-z', zoneinfo_path]
    tzupdate.main(args)
    assert_true(
        link_localtime_mock.called_once_with(
            FAKE_TIMEZONE,
            zoneinfo_path,
            localtime_path,
        ), )
コード例 #14
0
ファイル: e2e_tests.py プロジェクト: drewbare/tzupdate
def test_explicit_paths(link_localtime_mock, deb_tz_mock):
    setup_basic_api_response()
    localtime_path = '/l'
    zoneinfo_path = '/z'
    deb_path = '/d'
    args = ['-l', localtime_path, '-z', zoneinfo_path, '-d', deb_path]
    tzupdate.main(args, services=FAKE_SERVICES)
    link_localtime_mock.assert_called_once_with(
        FAKE_TIMEZONE,
        zoneinfo_path,
        localtime_path,
    )
    deb_tz_mock.assert_called_once_with(FAKE_TIMEZONE, deb_path)
コード例 #15
0
ファイル: e2e_tests.py プロジェクト: cdown/tzupdate
def test_explicit_ip(_unused_ll, _unused_deb):
    setup_basic_api_response()
    ip_addr = "1.2.3.4"
    args = ["-a", ip_addr]
    tzupdate.main(args, services=FAKE_SERVICES)
コード例 #16
0
ファイル: test_e2e.py プロジェクト: pshlos46/tzupdate
def test_print_sys_tz_no_link(link_localtime_mock, deb_tz_mock):
    args = ["--print-system-timezone"]
    tzupdate.main(args, services=FAKE_SERVICES)
    assert not link_localtime_mock.called
    assert not deb_tz_mock.called
コード例 #17
0
ファイル: e2e_tests.py プロジェクト: cdown/tzupdate
def test_print_only_no_link(link_localtime_mock, deb_tz_mock):
    setup_basic_api_response()
    args = ["-p"]
    tzupdate.main(args, services=FAKE_SERVICES)
    assert_false(link_localtime_mock.called)
    assert_false(deb_tz_mock.called)
コード例 #18
0
ファイル: e2e_tests.py プロジェクト: whwright/tzupdate
def test_end_to_end_no_args(link_localtime_mock, get_timezone_for_ip_mock):
    get_timezone_for_ip_mock.return_value = FAKE_TIMEZONE
    args = []
    tzupdate.main(args)
    assert_true(link_localtime_mock.called)
コード例 #19
0
ファイル: e2e_tests.py プロジェクト: jbrockmendel/tzupdate
def test_print_only_no_link(link_localtime_mock, get_timezone_for_ip_mock):
    get_timezone_for_ip_mock.return_value = FAKE_TIMEZONE
    args = ['-p']
    tzupdate.main(args)
    assert_false(link_localtime_mock.called)
コード例 #20
0
ファイル: e2e_tests.py プロジェクト: drewbare/tzupdate
def test_explicit_ip(_unused_ll, _unused_deb):
    setup_basic_api_response()
    ip_addr = '1.2.3.4'
    args = ['-a', ip_addr]
    tzupdate.main(args, services=FAKE_SERVICES)
コード例 #21
0
ファイル: e2e_tests.py プロジェクト: whwright/tzupdate
def test_print_only_no_link(link_localtime_mock, get_timezone_for_ip_mock):
    get_timezone_for_ip_mock.return_value = FAKE_TIMEZONE
    args = ['-p']
    tzupdate.main(args)
    assert_false(link_localtime_mock.called)
コード例 #22
0
ファイル: e2e_tests.py プロジェクト: jbrockmendel/tzupdate
def test_end_to_end_no_args(link_localtime_mock, get_timezone_for_ip_mock):
    get_timezone_for_ip_mock.return_value = FAKE_TIMEZONE
    args = []
    tzupdate.main(args)
    assert_true(link_localtime_mock.called)
コード例 #23
0
ファイル: e2e_tests.py プロジェクト: whwright/tzupdate
def test_explicit_ip(_, get_timezone_for_ip_mock):
    ip_addr = '1.2.3.4'
    get_timezone_for_ip_mock.return_value = FAKE_TIMEZONE
    args = ['-a', ip_addr]
    tzupdate.main(args)
    assert_true(get_timezone_for_ip_mock.called_once_with(ip_addr))
コード例 #24
0
ファイル: e2e_tests.py プロジェクト: drewbare/tzupdate
def test_print_only_no_link(link_localtime_mock, deb_tz_mock):
    setup_basic_api_response()
    args = ['-p']
    tzupdate.main(args, services=FAKE_SERVICES)
    assert_false(link_localtime_mock.called)
    assert_false(deb_tz_mock.called)
コード例 #25
0
ファイル: e2e_tests.py プロジェクト: jbrockmendel/tzupdate
def test_explicit_ip(_, get_timezone_for_ip_mock):
    ip_addr = '1.2.3.4'
    get_timezone_for_ip_mock.return_value = FAKE_TIMEZONE
    args = ['-a', ip_addr]
    tzupdate.main(args)
    assert_true(get_timezone_for_ip_mock.called_once_with(ip_addr))