Skip to content

Commit

Permalink
Add a bit more randomness to another test that fails with older crede…
Browse files Browse the repository at this point in the history
…ntials
  • Loading branch information
Eric Mann committed Aug 16, 2017
1 parent f7b36c5 commit 9c46987
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions client_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,30 +171,31 @@ func haveSharedWith(id, recordType string) (bool, error) {
// TestShareThenUnshare should share then revoke sharing
func TestShareThenUnshare(t *testing.T) {
data := make(map[string]string)
ctype := "test-share-data-" + base64Encode(randomSecretKey()[:8])
data["message"] = "Hello, world!"
_, err := client.Write(context.Background(), "test-share-data", data, nil)
_, err := client.Write(context.Background(), ctype, data, nil)
if err != nil {
t.Fatal(err)
}

err = client.Share(context.Background(), "test-share-data", clientSharedWithID)
err = client.Share(context.Background(), ctype, clientSharedWithID)
if err != nil {
t.Error(err)
}

isShared, err := haveSharedWith(clientSharedWithID, "test-share-data")
isShared, err := haveSharedWith(clientSharedWithID, ctype)
if err != nil {
t.Errorf("share failed: %s", err)
} else if !isShared {
t.Error("share: have not shared with client")
}

err = client.Unshare(context.Background(), "test-share-data", clientSharedWithID)
err = client.Unshare(context.Background(), ctype, clientSharedWithID)
if err != nil {
t.Errorf("Unshare failed: %s", err)
}

isShared, err = haveSharedWith(clientSharedWithID, "test-share-data")
isShared, err = haveSharedWith(clientSharedWithID, ctype)
if err != nil {
t.Errorf("unshare failed: %s", err)
} else if isShared {
Expand Down

0 comments on commit 9c46987

Please sign in to comment.