def add_review(self, movie: Movie, review_text: str, rating: int,
                user: str):
     user_to_add = self._session_cm.session.query(User).filter(
         User.username.like(user)).one()
     review = Review(movie, review_text, rating, user_to_add)
     with self._session_cm as scm:
         scm.session.add(review)
         scm.commit()
Esempio n. 2
0
def test_1():
    name = Review("Moviename", "movie is v good", 8, "Banana")
    assert name.movie == "Moviename"
    assert name.review_text == "movie is v good"
    assert name.rating == 8
    assert name.user == "Banana"
Esempio n. 3
0
def test_5():
    name = Review("Moviename", "movie is v good", 8, "Banana")
    assert name.__repr__(
    ) == f"Moviename\nmovie is v good\n8\n{name.timestamp}"
Esempio n. 4
0
def test_4():
    name1 = Review("Moviename", "movie is v good", 8, "Banana")
    name2 = Review("Moviename", "movie is v good", 8, "Banana")
    assert name1 == name1
    assert name1 == name2
Esempio n. 5
0
def test_3():
    name = Review("name", "ok", "aFS", "Banana")
    assert name.rating is None
Esempio n. 6
0
def test_2():
    name = Review(123, 123, -8, "Banana")
    assert name.movie == ""
    assert name.review_text == ""
    assert name.rating is None
    assert name.user == "Banana"
Esempio n. 7
0
 def add_review(self, movie: str, review_text: str, rating: int, user: str):
     self._reviews.append(Review(movie, review_text, rating, user))
 def add_review(self, movie: Movie, review_text: str, rating: int,
                username: str):
     for i in self._users:
         if i.username == username:
             self._reviews.append(Review(movie, review_text, rating, i))