def test_delete_scorecard(self): self.get_to_scorecard_and_fill_out() test_user_before = self.get_test_user() # Assert if scorecard is in database self.assertIsNotNone( Scorecard.find( _id=ObjectId(test_user_before.i_score_Oid[0])).first_or_none()) self.driver.find_element_by_id('delete_button').click() self.handle_pop_up() # Assert redirect self.assert_profile_redirect() # Assert scorecard not in complete test_user = self.get_test_user() self.assertEqual(0, len(test_user.c_score_Oid)) # Assert scorecard not in incomplete self.assertEqual(0, len(test_user.i_score_Oid)) # Assert scorecard not in database self.assertIsNone( Scorecard.find( _id=ObjectId(test_user_before.i_score_Oid[0])).first_or_none())
def add_scorecard(player_summary): e = 'success' try: Scorecard.insert_one(player_summary) except Exception as e: pass finally: return e
def tearDown(self) -> None: test_user = self.get_test_user() User.delete_one(user_name=self.user[1][1]) [ Scorecard.delete_one(_id=ObjectId(t_id)) for t_id in test_user.i_score_Oid ] [ Scorecard.delete_one(_id=ObjectId(t_id)) for t_id in test_user.c_score_Oid ] self.driver.close()
def complete_scorecards(self): return [Scorecard.find(_id=ObjectId(scorecard)).first_or_none() for scorecard in self.c_score_Oid]
def create_scorecard(round_summary): return Scorecard.insert_one(round_summary)
def delete_scorecard(scorecard): Scorecard.delete_one(_id=scorecard._id)
def get_scorecard(kwargs): return Scorecard.find(**kwargs).first_or_none()