Skip to content

Commit

Permalink
Annotate a couple of tests where sqlalchemy raises a warning
Browse files Browse the repository at this point in the history
In each case we're rolling back a transaction that's already rolled back
due to an integrity error.
  • Loading branch information
jcristau committed Feb 17, 2022
1 parent 51d8f67 commit 957d971
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/test_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from migrate.versioning.api import version
from sqlalchemy import Column, Integer, MetaData, String, Table, create_engine, select
from sqlalchemy.engine.reflection import Inspector
from sqlalchemy.testing.assertions import emits_warning

import auslib
from auslib.blobs.apprelease import ReleaseBlobV1
Expand Down Expand Up @@ -4456,6 +4457,7 @@ def testAddRelease(self):
expected = [("d", "d", False, createBlob(dict(name="d", schema_version=1, hashFunction="sha512")), 1)]
self.assertEqual(self.releases.t.select().where(self.releases.name == "d").execute().fetchall(), expected)

@emits_warning()
def testAddReleaseAlreadyExists(self):
blob = ReleaseBlobV1(name="a", hashFunction="sha512")
self.assertRaises(TransactionError, self.releases.insert, changed_by="bill", name="a", product="a", data=blob)
Expand Down Expand Up @@ -5365,6 +5367,7 @@ def testGrantRoleWithPermission(self):
def testGrantRoleWithoutPermission(self):
self.assertRaises(PermissionDeniedError, self.permissions.grantRole, username="rory", role="releng", changed_by="cathy")

@emits_warning()
def testGrantRoleExistingRole(self):
self.assertRaises(TransactionError, self.permissions.grantRole, username="bob", role="releng", changed_by="bill")

Expand Down

0 comments on commit 957d971

Please sign in to comment.