Beispiel #1
0
    def test_justify_argument_page_rep_not_twice(self):
        db_user: User = refresh_user('Björn')
        self.config.testing_securitypolicy(userid=db_user.nickname,
                                           permissive=True)

        clear_reputation_of_user(db_user)
        rep_history_before_new_rep = DBDiscussionSession.query(
            ReputationHistory).count()

        self.__call_function_and_count_seen_clicked_arguments()
        rep_history_after_new_rep = DBDiscussionSession.query(
            ReputationHistory).count()
        self.assertGreater(
            rep_history_after_new_rep, rep_history_before_new_rep,
            'Reputation should be granted on first confrontation')
        clear_seen_by_of(db_user.nickname)
        clear_clicks_of(db_user.nickname)

        self.__call_function_and_count_seen_clicked_arguments()
        rep_history_after_second_try = DBDiscussionSession.query(
            ReputationHistory).count()
        self.assertEqual(
            rep_history_after_new_rep, rep_history_after_second_try,
            'Reputation should NOT be granted twice for the first confrontation'
        )

        clear_reputation_of_user(db_user)
        clear_seen_by_of(db_user.nickname)
        clear_clicks_of(db_user.nickname)
Beispiel #2
0
 def tearDown(self):
     testing.tearDown()
     clear_seen_by_of('Tobias')
     clear_clicks_of('Tobias')
     clear_seen_by_of('Björn')
     clear_clicks_of('Björn')
     clear_reputation_of_user(self.user_bjoern)
     clear_reputation_of_user(self.user_tobi)
Beispiel #3
0
 def setUp(self):
     self.config = testing.setUp()
     self.config.include('pyramid_chameleon')
     self.default_request = testing.DummyRequest(matchdict={
         'slug': 'cat-or-dog',
         'arg_id_user': 2,
         'relation': Relations.UNDERMINE.value,
         'arg_id_sys': 16,
     })
     self.user_bjoern = DBDiscussionSession.query(User).get(4)
     self.user_tobi = DBDiscussionSession.query(User).get(2)
     clear_seen_by_of('Tobias')
     clear_clicks_of('Tobias')
     clear_seen_by_of('Björn')
     clear_clicks_of('Björn')
     clear_reputation_of_user(self.user_bjoern)
     clear_reputation_of_user(self.user_tobi)