Example #1
0
def Can_amend_a_poem_title__test():
    db = FakeDb()

    # Sanity - before modifying
    assert_equal(
        {
            "title"       : "title1",
            "author"      : "author1",
            "text"        : "text1",
            "contributor" : "user1"
        },
        db.poems.data["id1"]
    )

    # This is what we are testing
    poemtube.amendpoem( db, "id1", { "title": "title X" }, user="******" )

    # Title changed
    assert_equal(
        {
            "title"       : "title X",
            "author"      : "author1",
            "text"        : "text1",
            "contributor" : "user1"
        },
        db.poems.data["id1"]
    )
Example #2
0
def Can_amend_a_poem_text__test():
    db = FakeDb()

    # This is what we are testing
    poemtube.amendpoem( db, "id2", { "text": "text X" }, user="******" )

    # Title changed
    assert_equal(
        {
            "title"       : "title2",
            "author"      : "author2",
            "text"        : "text X",
            "contributor" : "user2"
        },
        db.poems.data["id2"]
    )
Example #3
0
def Amending_not_logged_in_is_an_error__test():
    poemtube.amendpoem( FakeDb(), "id1", { "text": "t" }, user=None )
Example #4
0
def Amending_someone_elses_poem_is_an_error__test():
    poemtube.amendpoem( FakeDb(), "id1", { "text": "t" }, user="******" )
Example #5
0
def Amending_an_unknown_id_is_an_error__test():
    poemtube.amendpoem( FakeDb(), "unknown", { "text": "t" }, user="******" )
Example #6
0
def Amending_using_unknown_property_is_an_error__test():
    poemtube.amendpoem(
        FakeDb(), "id1", { "text": "t", "badprop": "foo" }, user="******" )
Example #7
0
def Attempting_to_change_contributor_is_an_error__test():
    poemtube.amendpoem(
        FakeDb(), "id1", { "text": "t", "contributor": "foo" }, user="******" )
Example #8
0
def my_amendpoem(db, id, newprops, user):
    amendpoem(db, id, newprops, user)
    return ""
Example #9
0
def my_amendpoem( db, id, newprops, user ):
    amendpoem( db, id, newprops, user )
    return ""