Exemple #1
0
def test_clears_previous_history_on_display(driver):
    page = show_page(
        make_project_history(make_snapshot(name="1", path="previous.tgit"),
                             make_snapshot(name="2", path="oldest.tgit")))

    page.display_project_history(
        make_project_history(make_snapshot(name="1", path="last.tgit")))
    driver.shows_recent_projects(starts_with("1"))
Exemple #2
0
def test_displays_project_history(driver):
    _ = show_page(
        make_project_history(
            make_snapshot(name="Last", type_="mp3", path="last.tgit"),
            make_snapshot(name="Previous", type_="flac", path="previous.tgit"),
            make_snapshot(name="Oldest", type_="mp3", path="oldest.tgit")))

    driver.shows_recent_projects("Last (MP3)", "Previous (FLAC)",
                                 "Oldest (MP3)")
def test_overwrites_previous_history_on_store(store):
    cover_art = image_file(resources.path("front-cover.jpg"))
    store.store_history(make_project_history(make_snapshot(name="Previous", path="previous.tgit", cover_art=cover_art)))
    store.store_history(make_project_history(make_snapshot(name="Last", path="last.tgit")))

    overwritten_history = store.load_history()

    assert_that(overwritten_history, contains(snapshot_with(name="Last", path="last.tgit", cover_art=None)),
                "overwritten history")
def test_reorders_history_to_reflect_latest_updates():
    history = ProjectHistory(make_snapshot(path="1.tgit"),
                             make_snapshot(path="2.tgit"),
                             make_snapshot(path="3.tgit"))

    history.project_saved(make_project(filename="2.tgit"))

    assert_that(history, contains(snapshot_with(path="2.tgit"),
                                  snapshot_with(path="1.tgit"),
                                  snapshot_with(path="3.tgit")), "updated project history")
def test_round_trips_history_including_cover_thumbnail_to_settings_file(store):
    cover_art = image_file(resources.path("front-cover.jpg"))
    store.store_history(make_project_history(make_snapshot(name="Last", path="last.tgit", cover_art=cover_art),
                                             make_snapshot(name="Previous", path="previous.tgit")))

    persisted_history = store.load_history()

    assert_that(persisted_history, contains(
        snapshot_with(name="Last", path="last.tgit", cover_art=image_with(mime=cover_art.mime, data=cover_art.data,
                                                                          desc=cover_art.desc, type=cover_art.type)),
        snapshot_with(name="Previous", path="previous.tgit")), "persisted history")
def test_reorders_history_to_reflect_latest_updates():
    history = ProjectHistory(make_snapshot(path="1.tgit"),
                             make_snapshot(path="2.tgit"),
                             make_snapshot(path="3.tgit"))

    history.project_saved(make_project(filename="2.tgit"))

    assert_that(
        history,
        contains(snapshot_with(path="2.tgit"), snapshot_with(path="1.tgit"),
                 snapshot_with(path="3.tgit")), "updated project history")
def tests_stores_history_data_under_history_group_in_settings_file(store, driver):
    store.store_history(make_project_history(make_snapshot(name="Last", type_="flac", path="last.tgit"),
                                             make_snapshot(name="Previous", type_="mp3", path="previous.tgit"),
                                             make_snapshot(name="Oldest", type_="mp3", path="oldest.tgit")))

    driver.has_stored("history/size", 3)
    driver.has_stored("history/1/name", "Last")
    driver.has_stored("history/1/path", "last.tgit")
    driver.has_stored("history/1/type", "flac")
    driver.has_stored("history/2/name", "Previous")
    driver.has_stored("history/2/path", "previous.tgit")
    driver.has_stored("history/2/type", "mp3")
    driver.has_stored("history/3/name", "Oldest")
    driver.has_stored("history/3/path", "oldest.tgit")
    driver.has_stored("history/3/type", "mp3")
Exemple #8
0
def test_overwrites_previous_history_on_store(store):
    cover_art = image_file(resources.path("front-cover.jpg"))
    store.store_history(
        make_project_history(
            make_snapshot(name="Previous",
                          path="previous.tgit",
                          cover_art=cover_art)))
    store.store_history(
        make_project_history(make_snapshot(name="Last", path="last.tgit")))

    overwritten_history = store.load_history()

    assert_that(
        overwritten_history,
        contains(snapshot_with(name="Last", path="last.tgit", cover_art=None)),
        "overwritten history")
def test_signals_project_to_open_when_open_action_triggered(driver, using):
    signal = ValueMatcherProbe("open project", "project.tgit")

    _ = show_page(make_project_history(make_snapshot(name="project", path="project.tgit")),
                  on_load_project=signal.received)

    driver.open_recent_project(starts_with("project"), using=using)
    driver.check(signal)
def test_updates_history_and_reports_history_change_when_project_changes(subscriber):
    history = ProjectHistory(make_snapshot(path="updated.tgit", name="original"))

    subscriber.should_receive("history_changed").once()
    history.on_history_changed.subscribe(subscriber.history_changed)

    history.project_opened(make_project(filename="updated.tgit", release_name="updated"))

    assert_that(history, contains(snapshot_with(path="updated.tgit", name="updated")), "updated project history")
Exemple #11
0
def test_signals_project_to_open_when_open_action_triggered(driver, using):
    signal = ValueMatcherProbe("open project", "project.tgit")

    _ = show_page(make_project_history(
        make_snapshot(name="project", path="project.tgit")),
                  on_load_project=signal.received)

    driver.open_recent_project(starts_with("project"), using=using)
    driver.check(signal)
Exemple #12
0
def tests_stores_history_data_under_history_group_in_settings_file(
        store, driver):
    store.store_history(
        make_project_history(
            make_snapshot(name="Last", type_="flac", path="last.tgit"),
            make_snapshot(name="Previous", type_="mp3", path="previous.tgit"),
            make_snapshot(name="Oldest", type_="mp3", path="oldest.tgit")))

    driver.has_stored("history/size", 3)
    driver.has_stored("history/1/name", "Last")
    driver.has_stored("history/1/path", "last.tgit")
    driver.has_stored("history/1/type", "flac")
    driver.has_stored("history/2/name", "Previous")
    driver.has_stored("history/2/path", "previous.tgit")
    driver.has_stored("history/2/type", "mp3")
    driver.has_stored("history/3/name", "Oldest")
    driver.has_stored("history/3/path", "oldest.tgit")
    driver.has_stored("history/3/type", "mp3")
Exemple #13
0
def test_round_trips_history_including_cover_thumbnail_to_settings_file(store):
    cover_art = image_file(resources.path("front-cover.jpg"))
    store.store_history(
        make_project_history(
            make_snapshot(name="Last", path="last.tgit", cover_art=cover_art),
            make_snapshot(name="Previous", path="previous.tgit")))

    persisted_history = store.load_history()

    assert_that(
        persisted_history,
        contains(
            snapshot_with(name="Last",
                          path="last.tgit",
                          cover_art=image_with(mime=cover_art.mime,
                                               data=cover_art.data,
                                               desc=cover_art.desc,
                                               type=cover_art.type)),
            snapshot_with(name="Previous", path="previous.tgit")),
        "persisted history")
def test_updates_history_and_reports_history_change_when_project_changes(
        subscriber):
    history = ProjectHistory(
        make_snapshot(path="updated.tgit", name="original"))

    subscriber.should_receive("history_changed").once()
    history.on_history_changed.subscribe(subscriber.history_changed)

    history.project_opened(
        make_project(filename="updated.tgit", release_name="updated"))

    assert_that(history,
                contains(snapshot_with(path="updated.tgit", name="updated")),
                "updated project history")
Exemple #15
0
def test_disables_open_project_when_no_project_selected(driver):
    _ = show_page(make_project_history(make_snapshot(name="project")))

    driver.has_disabled_open_project()
    driver.select_project(starts_with("project"))
    driver.has_enabled_open_project()
def test_displays_project_history(driver):
    _ = show_page(make_project_history(make_snapshot(name="Last", type_="mp3", path="last.tgit"),
                                       make_snapshot(name="Previous", type_="flac", path="previous.tgit"),
                                       make_snapshot(name="Oldest", type_="mp3", path="oldest.tgit")))

    driver.shows_recent_projects("Last (MP3)", "Previous (FLAC)", "Oldest (MP3)")
def test_clears_previous_history_on_display(driver):
    page = show_page(make_project_history(make_snapshot(name="1", path="previous.tgit"),
                                          make_snapshot(name="2", path="oldest.tgit")))

    page.display_project_history(make_project_history(make_snapshot(name="1", path="last.tgit")))
    driver.shows_recent_projects(starts_with("1"))
def test_disables_open_project_when_no_project_selected(driver):
    _ = show_page(make_project_history(make_snapshot(name="project")))

    driver.has_disabled_open_project()
    driver.select_project(starts_with("project"))
    driver.has_enabled_open_project()