コード例 #1
0
def bad_uuid_bookmark(session, test_user):
    url_uuid = UUID("f" * 32)
    bad_uuid_url = sut.URL(
        url_uuid=url_uuid,
        scheme="http",
        netloc="example.com",
        path="/bad-uuid",
        query="",
        fragment="",
    )
    bookmark = make_bookmark(url=bad_uuid_url, tag_triples=frozenset())
    bookmark_uuid = sut.set_bookmark(session, test_user.user_uuid, bookmark)
    session.commit()

    yield
    # teardown is required to avoid leaving a dirty db around
    delete_bookmark(session, test_user.user_uuid, bookmark_uuid)
    delete_url(session, url_uuid)
    session.commit()
コード例 #2
0
def bad_canonicalisation_bookmark(session, test_user):
    # Needs a trailing slash
    url_uuid = uuid5(UUID_URL_NAMESPACE, "http://example.com")
    bad_uuid_url = sut.URL(
        url_uuid=url_uuid,
        scheme="http",
        netloc="example.com",
        path="",
        query="",
        fragment="",
    )
    bookmark = make_bookmark(url=bad_uuid_url, tag_triples=frozenset())
    bookmark_uuid = sut.set_bookmark(session, test_user.user_uuid, bookmark)
    session.commit()

    yield
    # teardown is required to avoid leaving a dirty db around
    delete_bookmark(session, test_user.user_uuid, bookmark_uuid)
    delete_url(session, url_uuid)
    session.commit()
コード例 #3
0
def bad_scheme_bookmark(session, test_user):
    url_uuid = uuid5(UUID_URL_NAMESPACE, "about:blank")
    bad_scheme_url = sut.URL(
        url_uuid=url_uuid,
        scheme="about",
        netloc="",
        path="blank",
        query="",
        fragment="",
    )

    bookmark = make_bookmark(url=bad_scheme_url, tag_triples=frozenset())
    bookmark_uuid = sut.set_bookmark(session, test_user.user_uuid, bookmark)
    session.commit()

    yield
    # teardown is required to avoid leaving a dirty db around
    delete_bookmark(session, test_user.user_uuid, bookmark_uuid)
    delete_url(session, url_uuid)
    session.commit()