← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:fix-snap-charm-push-failure into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:fix-snap-charm-push-failure into launchpad:master.

Commit message:
Fix a couple more tests for SnapStoreClient API changes

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/408593
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:fix-snap-charm-push-failure into launchpad:master.
diff --git a/lib/lp/scripts/tests/test_garbo.py b/lib/lp/scripts/tests/test_garbo.py
index 5fb7f77..62cbb4b 100644
--- a/lib/lp/scripts/tests/test_garbo.py
+++ b/lib/lp/scripts/tests/test_garbo.py
@@ -1995,6 +1995,9 @@ class TestGarbo(FakeAdapterMixin, TestCaseWithFactory):
         build1 = self.factory.makeSnapBuild(
             snap=snap1,
             status=BuildStatus.FULLYBUILT)
+        snap1_lfa = self.factory.makeLibraryFileAlias(
+            filename="test-snap.snap", content=b"dummy snap content")
+        self.factory.makeSnapFile(snapbuild=build1, libraryfile=snap1_lfa)
 
         # test that build1 does not get picked up
         # as it is a build without a store upload
@@ -2005,7 +2008,8 @@ class TestGarbo(FakeAdapterMixin, TestCaseWithFactory):
         # Upload build
         job = getUtility(ISnapStoreUploadJobSource).create(build1)
         client = FakeSnapStoreClient()
-        client.upload.result = (
+        client.uploadFile.result = 1
+        client.push.result = (
             "http://sca.example/dev/api/snaps/1/builds/1/status";)
         client.checkStatus.result = (
             "http://sca.example/dev/click-apps/1/rev/1/";, 1)
diff --git a/lib/lp/snappy/tests/test_snap.py b/lib/lp/snappy/tests/test_snap.py
index adb8cfa..e9d60f9 100644
--- a/lib/lp/snappy/tests/test_snap.py
+++ b/lib/lp/snappy/tests/test_snap.py
@@ -1089,6 +1089,10 @@ class TestSnap(TestCaseWithFactory):
         build = self.factory.makeSnapBuild(
             snap=snap1,
             status=BuildStatus.FULLYBUILT)
+        snap1_lfa = self.factory.makeLibraryFileAlias(
+            filename="test-snap.snap", content=b"dummy snap content",
+            db_only=True)
+        self.factory.makeSnapFile(snapbuild=build, libraryfile=snap1_lfa)
 
         # There is no build with revision 5 for snap1
         self.assertIsNone(snap1.getBuildByStoreRevision(5))
@@ -1096,7 +1100,8 @@ class TestSnap(TestCaseWithFactory):
         # Upload build1 and check we return it by version 1
         job = getUtility(ISnapStoreUploadJobSource).create(build)
         client = FakeSnapStoreClient()
-        client.upload.result = (
+        client.uploadFile.result = 1
+        client.push.result = (
             "http://sca.example/dev/api/snaps/1/builds/1/status";)
         client.checkStatus.result = (
             "http://sca.example/dev/click-apps/1/rev/1/";, 1)
@@ -1113,9 +1118,14 @@ class TestSnap(TestCaseWithFactory):
         build2 = self.factory.makeSnapBuild(
             snap=snap1,
             status=BuildStatus.FULLYBUILT)
+        snap2_lfa = self.factory.makeLibraryFileAlias(
+            filename="test-snap.snap", content=b"dummy snap content",
+            db_only=True)
+        self.factory.makeSnapFile(snapbuild=build2, libraryfile=snap2_lfa)
         job = getUtility(ISnapStoreUploadJobSource).create(build2)
         client = FakeSnapStoreClient()
-        client.upload.result = (
+        client.uploadFile.result = 2
+        client.push.result = (
             "http://sca.example/dev/api/snaps/1/builds/2/status";)
         client.checkStatus.result = (
             "http://sca.example/dev/click-apps/1/rev/2/";, 2)