Пример #1
0
    def test_accept_request_on_update_when_coaching_logged_in_user(self):
        renesmee = self.make_user('*****@*****.**')
        jacob = self.make_user('*****@*****.**')
        CoachRequest.get_or_insert_for(jacob, renesmee)

        coaches_json = [self.make_user_json(jacob, True)]
        coaches.update_coaches_and_requests(renesmee, coaches_json)

        self.assertTrue(renesmee.is_visible_to(jacob))
        requests_for_renesmee = CoachRequest.get_for_student(renesmee).fetch(1000)
        self.assertEqual(0, len(requests_for_renesmee))
Пример #2
0
    def test_accept_request_on_update_when_coaching_logged_in_user(self):
        renesmee = self.make_user('*****@*****.**')
        jacob = self.make_user('*****@*****.**')
        CoachRequest.get_or_insert_for(jacob, renesmee)

        coaches_json = [self.make_user_json(jacob, True)]
        coaches.update_coaches_and_requests(renesmee, coaches_json)

        self.assertTrue(renesmee.is_visible_to(jacob))
        requests_for_renesmee = CoachRequest.get_for_student(renesmee).fetch(
            1000)
        self.assertEqual(0, len(requests_for_renesmee))
Пример #3
0
    def test_noop_on_update_when_not_coaching_logged_in_user(self):
        # Bella + Edward's daughter,
        # (Spoiler Alert!) who Jacob falls in love with in Book 4
        renesmee = self.make_user('*****@*****.**')
        jacob = self.make_user('*****@*****.**')
        CoachRequest.get_or_insert_for(jacob, renesmee)
        requests_for_renesmee = CoachRequest.get_for_student(renesmee).fetch(1000)
        self.assertEqual(1, len(requests_for_renesmee))

        coaches_json = [self.make_user_json(jacob, False)]
        coaches.update_coaches_and_requests(renesmee, coaches_json)

        self.assertFalse(renesmee.is_visible_to(jacob))
        requests_for_renesmee = CoachRequest.get_for_student(renesmee).fetch(1000)
        self.assertEqual(1, len(requests_for_renesmee))
Пример #4
0
    def test_noop_on_update_when_not_coaching_logged_in_user(self):
        # Bella + Edward's daughter,
        # (Spoiler Alert!) who Jacob falls in love with in Book 4
        renesmee = self.make_user('*****@*****.**')
        jacob = self.make_user('*****@*****.**')
        CoachRequest.get_or_insert_for(jacob, renesmee)
        requests_for_renesmee = CoachRequest.get_for_student(renesmee).fetch(
            1000)
        self.assertEqual(1, len(requests_for_renesmee))

        coaches_json = [self.make_user_json(jacob, False)]
        coaches.update_coaches_and_requests(renesmee, coaches_json)

        self.assertFalse(renesmee.is_visible_to(jacob))
        requests_for_renesmee = CoachRequest.get_for_student(renesmee).fetch(
            1000)
        self.assertEqual(1, len(requests_for_renesmee))