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"] )
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"] )
def Amending_not_logged_in_is_an_error__test(): poemtube.amendpoem( FakeDb(), "id1", { "text": "t" }, user=None )
def Amending_someone_elses_poem_is_an_error__test(): poemtube.amendpoem( FakeDb(), "id1", { "text": "t" }, user="******" )
def Amending_an_unknown_id_is_an_error__test(): poemtube.amendpoem( FakeDb(), "unknown", { "text": "t" }, user="******" )
def Amending_using_unknown_property_is_an_error__test(): poemtube.amendpoem( FakeDb(), "id1", { "text": "t", "badprop": "foo" }, user="******" )
def Attempting_to_change_contributor_is_an_error__test(): poemtube.amendpoem( FakeDb(), "id1", { "text": "t", "contributor": "foo" }, user="******" )
def my_amendpoem(db, id, newprops, user): amendpoem(db, id, newprops, user) return ""
def my_amendpoem( db, id, newprops, user ): amendpoem( db, id, newprops, user ) return ""