def test_signals_contributor_changed(driver):
    signal = KeywordsValueMatcherProbe("metadata changed")

    _ = show_page(make_chain_of_title(
        authors_composers=[contributor("Joel Miller")],
        publishers=[contributor("Big Deal Music")]),
                  on_contributor_changed=signal.received)

    signal.expect(has_entries(affiliation="SOCAN"))
    driver.change_affiliation_of_contributor("Joel Miller", "SOCAN")
    driver.check(signal)

    signal.expect(has_entries(publisher="Big Deal Music"))
    driver.change_publisher_of_contributor("Joel Miller", "Big Deal Music")
    driver.check(signal)

    signal.expect(has_entries(share="50"))
    driver.change_share_of_contributor("Joel Miller", "50")
    driver.check(signal)

    signal.expect(has_entries(affiliation="BMI"))
    driver.change_affiliation_of_publisher("Big Deal Music", "BMI")
    driver.check(signal)

    signal.expect(has_entries(share="50"))
    driver.change_share_of_publisher("Big Deal Music", "50")
    driver.check(signal)
Esempio n. 2
0
def test_signals_chain_of_value_changed_on_contributor_added():
    chain_of_title = make_chain_of_title(
        authors_composers=[joel_miller(), john_roney()],
        publishers=[effendi_records()])

    subscriber = Subscriber()
    chain_of_title.changed.subscribe(subscriber)

    chain_of_title.update(lyricists=["Joel Miller", "Rebecca Ann Maloy"],
                          composers=["John Roney"],
                          publishers=["Effendi Records"])

    assert_that(
        subscriber.events,
        contains(
            contains(
                has_property(
                    "contributors",
                    all_of(
                        has_author_composer("John Roney",
                                            has_entry("name", "John Roney")),
                        has_author_composer("Joel Miller",
                                            has_entry("name",
                                                      "Joel Miller")))))),
        "The chain of title")
Esempio n. 3
0
def test_round_trips_chain_of_title_to_disk(project_file, mp3):
    album_file = project_file("album.tgit")
    original_filename = mp3()
    chain_of_title = make_chain_of_title(
        authors_composers=[joel_miller(), john_roney()],
        publishers=[effendi_records()])
    original_track = make_track(original_filename,
                                chain_of_title=chain_of_title,
                                track_title="Chevere!")

    original_album = build.album(filename=album_file,
                                 version="2.4.0",
                                 type=Album.Type.FLAC,
                                 lead_performer="Joel Miller",
                                 tracks=[original_track])

    local_project.save_project(
        original_album,
        track_name=lambda current_track: current_track.track_title + ".mp3")
    os.remove(original_filename)
    track = local_project.load_project(album_file).tracks[0]

    assert_that(track.chain_of_title.contributors,
                has_author_composer("Joel Miller", joel_miller()),
                "The contributors")
    assert_that(track.chain_of_title.contributors,
                has_author_composer("John Roney", john_roney()),
                "The contributors")
    assert_that(track.chain_of_title.contributors,
                has_publisher("Effendi Records", effendi_records()),
                "The contributors")
Esempio n. 4
0
def test_does_not_signal_chain_of_value_when_contributors_have_not_changed():
    chain_of_title = make_chain_of_title(authors_composers=[joel_miller()])

    subscriber = Subscriber()
    chain_of_title.changed.subscribe(subscriber)

    chain_of_title.update(lyricists=["Joel Miller"], composers=[], publishers=[])

    assert_that(subscriber.events, empty(), "The chain of title")
Esempio n. 5
0
def test_removes_contributor_from_chain_of_title():
    chain_of_title = make_chain_of_title(
        authors_composers=[joel_miller(), john_roney(), contributor("Yoko Ono"), contributor("John Lennon")],
        publishers=[effendi_records(), contributor("Effendi Records")])

    chain_of_title.update(lyricists=["Joel Miller"], composers=["John Lennon"], publishers=["Effendi Records"])

    assert_that(chain_of_title, not_(any_of(has_key("John Roney"), has_key("Yoko Ono"), has_key("Universals"))),
                "The chain of title")
def test_displays_publisher_choices(driver):
    _ = show_page(
        make_chain_of_title(authors_composers=[joel_miller()],
                            publishers=[
                                contributor("Big Deal Music"),
                                contributor("Atlas Music")
                            ]))

    driver.shows_publisher_options_on_row(0, "", "Big Deal Music",
                                          "Atlas Music")
Esempio n. 7
0
def test_removes_linked_publisher_from_a_contributor_when_removing_a_publisher():
    chain_of_title = make_chain_of_title(authors_composers=[joel_miller(), john_roney()],
                                         publishers=[effendi_records()])

    chain_of_title.update(lyricists=["Joel Miller"], composers=["John Roney"], publishers=[])

    assert_that(chain_of_title.contributors,
                all_of(has_author_composer("John Roney", has_entry("publisher", "")),
                       has_author_composer("Joel Miller", has_entry("publisher", "")),
                       has_entry("publishers", not_(has_key("Effendi Records")))),
                "The chain of title")
Esempio n. 8
0
def test_signals_chain_of_value_changed_when_contributor_role_changes_from_lyricist_to_publisher():
    chain_of_title = make_chain_of_title(authors_composers=[joel_miller()])

    subscriber = Subscriber()
    chain_of_title.changed.subscribe(subscriber)

    chain_of_title.update(lyricists=[], publishers=["Joel Miller"], composers=[])

    assert_that(subscriber.events, contains(contains(
        has_property("contributors",
                     has_publisher("Joel Miller", has_entry("name", "Joel Miller"))))), "The chain of title")
Esempio n. 9
0
def test_does_not_signal_chain_of_value_when_contributors_have_not_changed():
    chain_of_title = make_chain_of_title(authors_composers=[joel_miller()])

    subscriber = Subscriber()
    chain_of_title.changed.subscribe(subscriber)

    chain_of_title.update(lyricists=["Joel Miller"],
                          composers=[],
                          publishers=[])

    assert_that(subscriber.events, empty(), "The chain of title")
def test_displays_affiliation_choices(driver):
    _ = show_page(
        make_chain_of_title(authors_composers=[joel_miller()],
                            publishers=[effendi_records()]))

    driver.shows_affiliation_options_for_contributor("Joel Miller", "",
                                                     "SOCAN", "ASCAP", "BMI",
                                                     "SACEM", "SABAM")
    driver.shows_affiliation_options_for_publisher("Effendi Records", "",
                                                   "SOCAN", "ASCAP", "BMI",
                                                   "SACEM", "SABAM")
Esempio n. 11
0
def test_adds_contributor_to_chain_of_title():
    chain_of_title = make_chain_of_title(authors_composers=[joel_miller(), john_roney()],
                                         publishers=[effendi_records()])
    chain_of_title.update(lyricists=["Joel Miller", "John Roney"],
                          composers=["John Roney", "Yoko Ono"],
                          publishers=["Effendi Records", "Universals"])

    assert_that(chain_of_title.contributors,
                all_of(has_author_composer("John Roney", has_entry("name", "John Roney")),
                       has_author_composer("Yoko Ono", has_entry("name", "Yoko Ono")),
                       has_publisher("Universals", has_entry("name", "Universals"))),
                "The chain of title")
Esempio n. 12
0
def test_signals_chain_of_value_changed_on_contributor_added():
    chain_of_title = make_chain_of_title(authors_composers=[joel_miller(), john_roney()],
                                         publishers=[effendi_records()])

    subscriber = Subscriber()
    chain_of_title.changed.subscribe(subscriber)

    chain_of_title.update(lyricists=["Joel Miller", "Rebecca Ann Maloy"], composers=["John Roney"],
                          publishers=["Effendi Records"])

    assert_that(subscriber.events, contains(contains(has_property("contributors", all_of(
        has_author_composer("John Roney", has_entry("name", "John Roney")),
        has_author_composer("Joel Miller", has_entry("name", "Joel Miller")))))), "The chain of title")
Esempio n. 13
0
def test_updates_contributors():
    chain_of_title = make_chain_of_title(authors_composers=[contributor("Joel Miller"), contributor("John Roney")],
                                         publishers=[contributor("Effendi Records")])

    chain_of_title.update_contributor(**joel_miller())
    chain_of_title.update_contributor(**john_roney())
    chain_of_title.update_contributor(**effendi_records())

    assert_that(chain_of_title.contributors, has_author_composer("Joel Miller", has_entries(joel_miller())),
                "The contributors")
    assert_that(chain_of_title.contributors, has_author_composer("John Roney", has_entries(john_roney())),
                "The contributors")
    assert_that(chain_of_title.contributors, has_publisher("Effendi Records", has_entries(effendi_records())),
                "The contributors")
Esempio n. 14
0
def test_adds_contributor_to_chain_of_title():
    chain_of_title = make_chain_of_title(
        authors_composers=[joel_miller(), john_roney()],
        publishers=[effendi_records()])
    chain_of_title.update(lyricists=["Joel Miller", "John Roney"],
                          composers=["John Roney", "Yoko Ono"],
                          publishers=["Effendi Records", "Universals"])

    assert_that(
        chain_of_title.contributors,
        all_of(
            has_author_composer("John Roney", has_entry("name", "John Roney")),
            has_author_composer("Yoko Ono", has_entry("name", "Yoko Ono")),
            has_publisher("Universals", has_entry("name", "Universals"))),
        "The chain of title")
Esempio n. 15
0
def test_removes_linked_publisher_from_a_contributor_when_removing_a_publisher(
):
    chain_of_title = make_chain_of_title(
        authors_composers=[joel_miller(), john_roney()],
        publishers=[effendi_records()])

    chain_of_title.update(lyricists=["Joel Miller"],
                          composers=["John Roney"],
                          publishers=[])

    assert_that(
        chain_of_title.contributors,
        all_of(has_author_composer("John Roney", has_entry("publisher", "")),
               has_author_composer("Joel Miller", has_entry("publisher", "")),
               has_entry("publishers", not_(has_key("Effendi Records")))),
        "The chain of title")
def test_displays_contributors(driver):
    chain = make_chain_of_title(
        authors_composers=[joel_miller(), john_roney()],
        publishers=[effendi_records()])
    _ = show_page(chain)

    driver.has_contributors_count(2)
    driver.shows_contributor_row_details("Joel Miller", None, None, "25")
    driver.shows_affiliation_of_contributor("Joel Miller", "SOCAN")
    driver.shows_publisher_of_contributor("Joel Miller", "Effendi Records")

    driver.shows_contributor_row_details("John Roney", None, None, "25")
    driver.shows_affiliation_of_contributor("John Roney", "ASCAP")
    driver.shows_publisher_of_contributor("John Roney", "Effendi Records")

    driver.has_publishers_count(1)
    driver.shows_publisher_row_details("Effendi Records", None, "50")
    driver.shows_affiliation_of_publisher("Effendi Records", "BMI")
Esempio n. 17
0
def test_round_trips_chain_of_title_to_disk(project_file, mp3):
    album_file = project_file("album.tgit")
    original_filename = mp3()
    chain_of_title = make_chain_of_title(authors_composers=[joel_miller(), john_roney()],
                                         publishers=[effendi_records()])
    original_track = make_track(original_filename, chain_of_title=chain_of_title, track_title="Chevere!")

    original_album = build.album(filename=album_file, version="2.4.0", type=Album.Type.FLAC,
                                 lead_performer="Joel Miller", tracks=[original_track])

    local_project.save_project(original_album, track_name=lambda current_track: current_track.track_title + ".mp3")
    os.remove(original_filename)
    track = local_project.load_project(album_file).tracks[0]

    assert_that(track.chain_of_title.contributors, has_author_composer("Joel Miller", joel_miller()),
                "The contributors")
    assert_that(track.chain_of_title.contributors, has_author_composer("John Roney", john_roney()),
                "The contributors")
    assert_that(track.chain_of_title.contributors, has_publisher("Effendi Records", effendi_records()),
                "The contributors")
Esempio n. 18
0
def test_signals_chain_of_value_changed_when_contributor_role_changes_from_lyricist_to_publisher(
):
    chain_of_title = make_chain_of_title(authors_composers=[joel_miller()])

    subscriber = Subscriber()
    chain_of_title.changed.subscribe(subscriber)

    chain_of_title.update(lyricists=[],
                          publishers=["Joel Miller"],
                          composers=[])

    assert_that(
        subscriber.events,
        contains(
            contains(
                has_property(
                    "contributors",
                    has_publisher("Joel Miller",
                                  has_entry("name", "Joel Miller"))))),
        "The chain of title")
Esempio n. 19
0
def test_removes_contributor_from_chain_of_title():
    chain_of_title = make_chain_of_title(
        authors_composers=[
            joel_miller(),
            john_roney(),
            contributor("Yoko Ono"),
            contributor("John Lennon")
        ],
        publishers=[effendi_records(),
                    contributor("Effendi Records")])

    chain_of_title.update(lyricists=["Joel Miller"],
                          composers=["John Lennon"],
                          publishers=["Effendi Records"])

    assert_that(
        chain_of_title,
        not_(
            any_of(has_key("John Roney"), has_key("Yoko Ono"),
                   has_key("Universals"))), "The chain of title")
Esempio n. 20
0
def test_updates_contributors():
    chain_of_title = make_chain_of_title(
        authors_composers=[
            contributor("Joel Miller"),
            contributor("John Roney")
        ],
        publishers=[contributor("Effendi Records")])

    chain_of_title.update_contributor(**joel_miller())
    chain_of_title.update_contributor(**john_roney())
    chain_of_title.update_contributor(**effendi_records())

    assert_that(chain_of_title.contributors,
                has_author_composer("Joel Miller", has_entries(joel_miller())),
                "The contributors")
    assert_that(chain_of_title.contributors,
                has_author_composer("John Roney", has_entries(john_roney())),
                "The contributors")
    assert_that(
        chain_of_title.contributors,
        has_publisher("Effendi Records", has_entries(effendi_records())),
        "The contributors")
def test_displays_column_headings(driver):
    _ = show_page(make_chain_of_title())

    driver.shows_contributors_column_headers("Name", "Affiliation",
                                             "Publisher", "Share (%)")
    driver.shows_publishers_column_headers("Name", "Affiliation", "Share (%)")