Esempio n. 1
0
 def test_movie_create(self):
     m = Movie.get_or_create("Monty Python and the Holy Test")
     db.session.add(m)
     db.session.commit()
     ms = Movie.query.filter_by(title="Monty Python and the Holy Test").all()
     assert len(ms) == 1
     assert ms[0].title == "Monty Python and the Holy Test"
Esempio n. 2
0
 def test_comment_create(self):
     m = Movie.get_or_create("Monty Python and the Holy Test")
     u = User.create("commenter", "*****@*****.**", "asdfasdf")
     db.session.add(m)
     db.session.add(u)
     db.session.commit()
     c = Comment(user_id=u.id, contents="4/5. Lots of good testing moments.")
     m.add_comment(c)
     comments = Comment.query.filter_by(user_id=u.id, movie_id=m.id).all()
     assert len(comments) == 1
     assert "good testing moments" in comments[0].contents