services/application/applicationd: s/Put/PutX in tests
Change-Id: I4d904c8d2bfe19531d2718d209a901f92224f1d4
diff --git a/services/application/applicationd/impl_test.go b/services/application/applicationd/impl_test.go
index 0330514..45b925e 100644
--- a/services/application/applicationd/impl_test.go
+++ b/services/application/applicationd/impl_test.go
@@ -129,14 +129,17 @@
}
checkNoProfile(t, ctx, stub)
- // Test Put(), adding a number of application envelopes.
- if err := stubV1.Put(ctx, []string{"base", "media"}, envelopeV1); err != nil {
- t.Fatalf("Put() failed: %v", err)
+ // Test PutX(), adding a number of application envelopes.
+ if err := stubV1.PutX(ctx, "base", envelopeV1, false); err != nil {
+ t.Fatalf("PutX() failed: %v", err)
}
- if err := stubV2.Put(ctx, []string{"base"}, envelopeV2); err != nil {
- t.Fatalf("Put() failed: %v", err)
+ if err := stubV1.PutX(ctx, "media", envelopeV1, false); err != nil {
+ t.Fatalf("PutX() failed: %v", err)
}
- if err := stub.Put(ctx, []string{"base", "media"}, envelopeV1); err == nil || verror.ErrorID(err) != appd.ErrInvalidSuffix.ID {
+ if err := stubV2.PutX(ctx, "base", envelopeV2, false); err != nil {
+ t.Fatalf("PutX() failed: %v", err)
+ }
+ if err := stub.PutX(ctx, "base", envelopeV1, false); err == nil || verror.ErrorID(err) != appd.ErrInvalidSuffix.ID {
t.Fatalf("Unexpected error: expected %v, got %v", appd.ErrInvalidSuffix, err)
}
@@ -160,8 +163,8 @@
// Test that if we add another envelope for a version that's the highest
// in sort order, the new envelope becomes the latest.
- if err := stubV3.Put(ctx, []string{"base"}, envelopeV3); err != nil {
- t.Fatalf("Put() failed: %v", err)
+ if err := stubV3.PutX(ctx, "base", envelopeV3, false); err != nil {
+ t.Fatalf("PutX() failed: %v", err)
}
checkEnvelope(t, ctx, envelopeV3, stub, "base", "media")
checkProfiles(t, ctx, stubV3, "base")
@@ -176,8 +179,8 @@
},
Publisher: blessings,
}
- if err := stubV0.Put(ctx, []string{"base"}, envelopeV0); err != nil {
- t.Fatalf("Put() failed: %v", err)
+ if err := stubV0.PutX(ctx, "base", envelopeV0, false); err != nil {
+ t.Fatalf("PutX() failed: %v", err)
}
checkEnvelope(t, ctx, envelopeV3, stub, "base", "media")
@@ -312,8 +315,8 @@
Publisher: blessings,
}
- if err := stubV1.Put(ctx, []string{"media"}, envelopeV1); err != nil {
- t.Fatalf("Put() failed: %v", err)
+ if err := stubV1.PutX(ctx, "media", envelopeV1, false); err != nil {
+ t.Fatalf("PutX() failed: %v", err)
}
// There is content here now.
@@ -467,8 +470,8 @@
// Test that we can add an envelope for v3 with profile media and after calling
// TidyNow(), there will be all versions still in glob but v0 will only match profile
// base and not have an envelope for profile media.
- if err := stubs[3].Put(ctx, []string{"media"}, envelopeV3); err != nil {
- t.Fatalf("Put() failed: %v", err)
+ if err := stubs[3].PutX(ctx, "media", envelopeV3, false); err != nil {
+ t.Fatalf("PutX() failed: %v", err)
}
if err := stubs[0].TidyNow(ctx); err != nil {
@@ -536,8 +539,10 @@
func stuffEnvelopes(t *testing.T, ctx *context.T, stubs []repository.ApplicationClientStub, pets []profEnvTuple) {
for i, pet := range pets {
- if err := stubs[i].Put(ctx, pet.p, *pet.e); err != nil {
- t.Fatalf("%d: Put(%v) failed: %v", i, pet, err)
+ for _, profile := range pet.p {
+ if err := stubs[i].PutX(ctx, profile, *pet.e, true); err != nil {
+ t.Fatalf("%d: PutX(%v) failed: %v", i, pet, err)
+ }
}
}
}
diff --git a/services/application/applicationd/perms_test.go b/services/application/applicationd/perms_test.go
index f934eec..f796367 100644
--- a/services/application/applicationd/perms_test.go
+++ b/services/application/applicationd/perms_test.go
@@ -101,13 +101,13 @@
}
// Envelope putting as other should fail.
- if err := v1stub.Put(otherCtx, []string{"base"}, envelopeV1); verror.ErrorID(err) != verror.ErrNoAccess.ID {
- t.Fatalf("Put() returned errorid=%v wanted errorid=%v [%v]", verror.ErrorID(err), verror.ErrNoAccess.ID, err)
+ if err := v1stub.PutX(otherCtx, "base", envelopeV1, false); verror.ErrorID(err) != verror.ErrNoAccess.ID {
+ t.Fatalf("PutX() returned errorid=%v wanted errorid=%v [%v]", verror.ErrorID(err), verror.ErrNoAccess.ID, err)
}
// Envelope putting as global should succeed.
- if err := v1stub.Put(ctx, []string{"base"}, envelopeV1); err != nil {
- t.Fatalf("Put() failed: %v", err)
+ if err := v1stub.PutX(ctx, "base", envelopeV1, false); err != nil {
+ t.Fatalf("PutX() failed: %v", err)
}
ctx.VI(2).Infof("Accessing the Permission Lists of the root returns a (simulated) list providing default authorization.")
@@ -158,8 +158,8 @@
}
// Envelope putting as other should now succeed.
- if err := v1stub.Put(otherCtx, []string{"base"}, envelopeV1); err != nil {
- t.Fatalf("Put() wrongly failed: %v", err)
+ if err := v1stub.PutX(otherCtx, "base", envelopeV1, true); err != nil {
+ t.Fatalf("PutX() wrongly failed: %v", err)
}
// Other takes control.
@@ -243,16 +243,16 @@
ctx.VI(2).Info("Upload an envelope")
v1stub := repository.ApplicationClient("repo/search/v1")
- if err := v1stub.Put(ctx, []string{"base"}, envelopeV1); err != nil {
- t.Fatalf("Put() failed: %v", err)
+ if err := v1stub.PutX(ctx, "base", envelopeV1, false); err != nil {
+ t.Fatalf("PutX() failed: %v", err)
}
v2stub := repository.ApplicationClient("repo/search/v2")
- if err := v2stub.Put(ctx, []string{"base"}, envelopeV1); err != nil {
- t.Fatalf("Put() failed: %v", err)
+ if err := v2stub.PutX(ctx, "base", envelopeV1, false); err != nil {
+ t.Fatalf("PutX() failed: %v", err)
}
v3stub := repository.ApplicationClient("repo/naps/v1")
- if err := v3stub.Put(ctx, []string{"base"}, envelopeV1); err != nil {
- t.Fatalf("Put() failed: %v", err)
+ if err := v3stub.PutX(ctx, "base", envelopeV1, false); err != nil {
+ t.Fatalf("PutX() failed: %v", err)
}
ctx.VI(2).Info("Self can access Permissions but other can't.")
@@ -377,8 +377,8 @@
// Other can now upload an envelope at both locations.
for _, stub := range []repository.ApplicationClientStub{v1stub, v2stub} {
- if err := stub.Put(otherCtx, []string{"base"}, envelopeV1); err != nil {
- t.Fatalf("Put() failed: %v", err)
+ if err := stub.PutX(otherCtx, "base", envelopeV1, true); err != nil {
+ t.Fatalf("PutX() failed: %v", err)
}
}