Beispiel #1
0
    def test_add_bookmark_to_user_folder(client):

        # create folder
        temp_folder_title = TestClient.random_folder_name()
        folder_to_add = Folder(title=temp_folder_title)
        temp_folder = client.add_folder(folder_to_add)

        TestClient._test_add_bookmark_to_folder(client, temp_folder)

        client.delete_folder(temp_folder)
Beispiel #2
0
    def test_create_folder():

        folder = Folder(
            folder_id="ID",
            title="TITLE",
            slug="SLUG",
        )

        assert folder.id == "ID"
        assert folder.title == "TITLE"
        assert folder.slug == "SLUG"
Beispiel #3
0
    def test_list_bookmarks_in_user_folder(client):

        # create new folder
        new_folder_name = TestClient.random_folder_name()
        folder_to_add = Folder(title=new_folder_name)
        added_folder = client.add_folder(folder_to_add)
        print(added_folder)

        bookmarks = client.list_bookmarks(added_folder)
        assert bookmarks is not None

        # delete folder
        client.delete_folder(added_folder)
Beispiel #4
0
    def test_folder_from_json():

        json = {
            "folder_id": "ID",
            "title": "TITLE",
            "slug": "SLUG",
        }

        folder = Folder.from_json(json)

        assert folder.id == "ID"
        assert folder.title == "TITLE"
        assert folder.slug == "SLUG"
Beispiel #5
0
    def test_delete_folder(client):

        # create new folder
        new_folder_name = TestClient.random_folder_name()
        folder_to_add = Folder(title=new_folder_name)
        added_folder = client.add_folder(folder_to_add)
        print(added_folder)

        folders_before = client.list_folders()
        assert new_folder_name in [f.title for f in folders_before]

        # delete folder
        client.delete_folder(added_folder)

        folders_after = client.list_folders()
        assert new_folder_name not in [f.title for f in folders_after]
Beispiel #6
0
    def test_move_bookmark_from_user_folder_to_unread(client):

        # create folder
        temp_folder_title = TestClient.random_folder_name()
        folder_to_add = Folder(title=temp_folder_title)
        temp_folder = client.add_folder(folder_to_add)

        url = "https://www.bbc.co.uk/news/uk-politics-49651969"
        bookmark_to_add = Bookmark(url=url)
        new_bookmark = client.add_bookmark(bookmark_to_add, temp_folder)

        client.move_bookmark(new_bookmark, UNREAD_FOLDER)

        bookmarks = client.list_bookmarks(UNREAD_FOLDER)
        assert new_bookmark.id in [b.id for b in bookmarks]

        client.delete_bookmark(new_bookmark)
        client.delete_folder(temp_folder)
Beispiel #7
0
    def test_move_bookmark_from_unread_to_user_folder(client):

        # create folder
        temp_folder_title = TestClient.random_folder_name()
        folder_to_add = Folder(title=temp_folder_title)
        temp_folder = client.add_folder(folder_to_add)

        url = "https://www.bbc.co.uk/news/uk-politics-49651969"
        bookmark_to_add = Bookmark(url=url)
        new_bookmark = client.add_bookmark(bookmark_to_add)

        client.move_bookmark(new_bookmark, temp_folder)

        bookmarks = client.list_bookmarks(temp_folder)
        assert len(bookmarks) == 1
        assert bookmarks[0].id == new_bookmark.id

        client.delete_folder(temp_folder)
Beispiel #8
0
    def test_delete_bookmark(client):

        # create folder
        temp_folder_title = TestClient.random_folder_name()
        folder_to_add = Folder(title=temp_folder_title)
        temp_folder = client.add_folder(folder_to_add)

        url = "https://www.bbc.co.uk/news/uk-politics-49651969"

        bookmark_to_add = Bookmark(url=url)
        new_bookmark = client.add_bookmark(bookmark_to_add, temp_folder)
        print(new_bookmark)
        assert new_bookmark is not None

        bookmarks_before = client.list_bookmarks(temp_folder)
        assert new_bookmark.id in [b.id for b in bookmarks_before]

        client.delete_bookmark(new_bookmark)

        bookmarks_after = client.list_bookmarks(temp_folder)
        assert new_bookmark.id not in [b.id for b in bookmarks_after]

        client.delete_folder(temp_folder)