← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~twom/launchpad:oci-json-credentials-typerror into launchpad:master

 

Tom Wardill has proposed merging ~twom/launchpad:oci-json-credentials-typerror into launchpad:master.

Commit message:
Use postgres JSON field

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~twom/launchpad/+git/launchpad/+merge/381756

Storm has a postgres specific JSON field to avoid trying to double-load JSON. 
Use that instead of the default.

Includes test change to reproduce error.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~twom/launchpad:oci-json-credentials-typerror into launchpad:master.
diff --git a/lib/lp/oci/model/ocirecipebuildjob.py b/lib/lp/oci/model/ocirecipebuildjob.py
index bb6fc95..7d8699c 100644
--- a/lib/lp/oci/model/ocirecipebuildjob.py
+++ b/lib/lp/oci/model/ocirecipebuildjob.py
@@ -16,9 +16,9 @@ from lazr.enum import (
     DBEnumeratedType,
     DBItem,
     )
+from storm.databases.postgres import JSON
 from storm.locals import (
     Int,
-    JSON,
     Reference,
     )
 from zope.interface import implementer
diff --git a/lib/lp/oci/model/ociregistrycredentials.py b/lib/lp/oci/model/ociregistrycredentials.py
index 56d930a..2a70159 100644
--- a/lib/lp/oci/model/ociregistrycredentials.py
+++ b/lib/lp/oci/model/ociregistrycredentials.py
@@ -14,9 +14,9 @@ __all__ = [
 import base64
 import json
 
+from storm.databases.postgres import JSON
 from storm.locals import (
     Int,
-    JSON,
     Reference,
     Storm,
     Unicode,
diff --git a/lib/lp/oci/tests/test_ociregistrycredentials.py b/lib/lp/oci/tests/test_ociregistrycredentials.py
index fba4b1a..50953da 100644
--- a/lib/lp/oci/tests/test_ociregistrycredentials.py
+++ b/lib/lp/oci/tests/test_ociregistrycredentials.py
@@ -12,6 +12,7 @@ from testtools.matchers import (
     Equals,
     MatchesDict,
     )
+import transaction
 from zope.component import getUtility
 from zope.security.proxy import removeSecurityProxy
 
@@ -99,6 +100,7 @@ class TestOCIRegistryCredentialsSet(OCIConfigHelperMixin, TestCaseWithFactory):
         # make some that have a different owner
         for _ in range(5):
             self.factory.makeOCIRegistryCredentials()
+        transaction.commit()
 
         found = getUtility(IOCIRegistryCredentialsSet).findByOwner(owner)
         self.assertEqual(found.count(), 3)