예제 #1
0
    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())
예제 #2
0
def add_scorecard(player_summary):
    e = 'success'
    try:
        Scorecard.insert_one(player_summary)

    except Exception as e:
        pass

    finally:
        return e
예제 #3
0
    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()
예제 #4
0
 def complete_scorecards(self):
     return [Scorecard.find(_id=ObjectId(scorecard)).first_or_none() for scorecard in self.c_score_Oid]
예제 #5
0
def create_scorecard(round_summary):
    return Scorecard.insert_one(round_summary)
예제 #6
0
def delete_scorecard(scorecard):
    Scorecard.delete_one(_id=scorecard._id)
예제 #7
0
def get_scorecard(kwargs):
    return Scorecard.find(**kwargs).first_or_none()