Exemple #1
0
    def test_other_db_errors_are_raised_directly(self, db_session, integrity_error):
        action = GroupMembershipCreateAction(db_session)
        with patch.object(action, "_execute_statement") as _execute_statement:
            _execute_statement.side_effect = integrity_error

            with pytest.raises(IntegrityError):
                action.execute([group_membership_create(1, 2)])
Exemple #2
0
 def commands(self, db_session, user, groups):
     return [group_membership_create(user.id, group.id) for group in groups]
Exemple #3
0
 def test_it_raises_conflict_with_bad_group_foreign_key(self, db_session, user):
     with pytest.raises(ConflictingDataError):
         GroupMembershipCreateAction(db_session).execute(
             [group_membership_create(user.id, 999999)]
         )