Fix transaction errors when running review group tests
Review Request #9177 — Created Sept. 7, 2017 and submitted
When running unit tests, if an
IntegrityErrorerror is raised (even if
it is caught), it will break the transaction the unit test runs in.
Therefore, we have to run the potentially exception-raising code in its
own atomic block to avoid this happening.
This also changes a mistaken reference to
Ran unit tests.
Could we use
get_or_create()? That way, even though there's one additional query, we don't at all impact the transaction in any form.
Actually, we get that query back if we pass in the returned
create_review_group()instead of using
with_local_site=. In fact, we save an additional query with the subsequent call. So I think this is the ideal way for multiple reasons.
Addressed Christian's issues
Revision 2 (+19 -13)