コード例 #1
0
ファイル: test_buku.py プロジェクト: ye-man/Buku
def test_convert_bookmark_set(export_type, exp_res, monkeypatch):
    from buku import convert_bookmark_set
    import buku
    bms = [(1, 'htttp://example.com', '', ',', '', 0),
           (1, 'htttp://example.org', None, ',', '', 0),
           (2, 'http://google.com', 'Google', ',', '', 0)]
    if export_type == 'random':
        with pytest.raises(AssertionError):
            convert_bookmark_set(bms, export_type=export_type)
    else:

        def return_fixed_number():
            return 1556430615

        monkeypatch.setattr(buku.time, 'time', return_fixed_number)
        res = convert_bookmark_set(bms, export_type=export_type)
        assert res['count'] == 3
        assert exp_res == res['data']
コード例 #2
0
def test_convert_bookmark_set(export_type, exp_res, monkeypatch):
    import buku
    from buku import convert_bookmark_set

    bms = [
        (1, "htttp://example.com", "", ",", "", 0),
        (1, "htttp://example.org", None, ",", "", 0),
        (2, "http://google.com", "Google", ",", "", 0),
    ]
    if export_type == "random":
        with pytest.raises(AssertionError):
            convert_bookmark_set(bms, export_type=export_type)
    else:

        def return_fixed_number():
            return 1556430615

        monkeypatch.setattr(buku.time, "time", return_fixed_number)
        res = convert_bookmark_set(bms, export_type=export_type)
        assert res["count"] == 3
        assert exp_res == res["data"]