From 588e5db2b06343e76fe80a92282ffcd7cd7beff2 Mon Sep 17 00:00:00 2001 From: hitenjain14 Date: Mon, 18 Nov 2024 13:56:17 +0530 Subject: [PATCH 1/4] share file and remove duplicate test --- tests/cli_tests/zboxcli_share_file_test.go | 67 +--------------------- 1 file changed, 2 insertions(+), 65 deletions(-) diff --git a/tests/cli_tests/zboxcli_share_file_test.go b/tests/cli_tests/zboxcli_share_file_test.go index c54a71227..ad569f2ba 100644 --- a/tests/cli_tests/zboxcli_share_file_test.go +++ b/tests/cli_tests/zboxcli_share_file_test.go @@ -234,7 +234,7 @@ func TestShareFile(testSetup *testing.T) { require.Contains(t, output[1], filepath.Base(file3)) }) - t.Run("Share to public a folder with single encrypted file using auth ticket with zero expiration", func(t *test.SystemTest) { + t.Run("Share to public a single encrypted file using auth ticket with zero expiration", func(t *test.SystemTest) { walletOwner := escapedTestName(t) allocationID, _ := createWalletAndAllocation(t, configPath, walletOwner) @@ -269,7 +269,7 @@ func TestShareFile(testSetup *testing.T) { shareParams := map[string]interface{}{ "allocation": allocationID, - "remotepath": "/subfolder1", + "remotepath": remoteOwnerPath, "expiration-seconds": 0, "encryptionpublickey": encKey, "clientid": clientId, @@ -533,69 +533,6 @@ func TestShareFile(testSetup *testing.T) { require.Contains(t, output[1], filepath.Base(file3)) }) - t.Run("Share to a private folder with single encrypted file using auth ticket with zero expiration", func(t *test.SystemTest) { - walletOwner := escapedTestName(t) - allocationID, _ := createWalletAndAllocation(t, configPath, walletOwner) - - // upload file - file := generateRandomTestFileName(t) - remoteOwnerPath := "/subfolder1/subfolder2/" + filepath.Base(file) - fileSize := int64(256) - err := createFileWithSize(file, fileSize) - require.Nil(t, err) - - uploadParams := map[string]interface{}{ - "allocation": allocationID, - "localpath": file, - "remotepath": remoteOwnerPath, - "encrypt": "", - } - output, err := uploadFile(t, configPath, uploadParams, true) - require.Nil(t, err, strings.Join(output, "\n")) - require.Len(t, output, 2) - require.Contains(t, output[1], StatusCompletedCB) - require.Contains(t, output[1], filepath.Base(file)) - - // receiver wallet operations - receiverWallet := escapedTestName(t) + "_second" - - createWalletForName(receiverWallet) - walletReceiver, err := getWalletForName(t, configPath, receiverWallet) - require.Nil(t, err) - - encKey := walletReceiver.EncryptionPublicKey - clientId := walletReceiver.ClientID - - shareParams := map[string]interface{}{ - "allocation": allocationID, - "remotepath": "/subfolder1", - "clientid": clientId, - "encryptionpublickey": encKey, - "expiration-seconds": 0, - } - output, err = shareFile(t, configPath, shareParams) - require.Nil(t, err, strings.Join(output, "\n")) - require.Len(t, output, 1, "share file - Unexpected output", strings.Join(output, "\n")) - - authTicket, err := extractAuthToken(output[0]) - require.Nil(t, err, "Error extracting auth token") - require.NotEqual(t, "", authTicket) - - // Download the file (delete local copy first) - os.Remove(file) - - downloadParams := createParams(map[string]interface{}{ - "localpath": file, - "authticket": authTicket, - "remotepath": remoteOwnerPath, - }) - output, err = downloadFileForWallet(t, receiverWallet, configPath, downloadParams, false) - require.Nil(t, err, strings.Join(output, "\n")) - require.Len(t, output, 2, "download file - Unexpected output", strings.Join(output, "\n")) - require.Contains(t, output[1], StatusCompletedCB) - require.Contains(t, output[1], filepath.Base(file)) - }) - t.Run("Share to public a folder with no encrypted file using auth ticket with zero expiration", func(t *test.SystemTest) { walletOwner := escapedTestName(t) allocationID, _ := createWalletAndAllocation(t, configPath, walletOwner) From 294539a94867bfe7804a8bc6954b21b93073fd02 Mon Sep 17 00:00:00 2001 From: hitenjain14 Date: Mon, 18 Nov 2024 13:59:14 +0530 Subject: [PATCH 2/4] fix error message --- tests/cli_tests/zboxcli_share_file_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/cli_tests/zboxcli_share_file_test.go b/tests/cli_tests/zboxcli_share_file_test.go index ad569f2ba..383194a04 100644 --- a/tests/cli_tests/zboxcli_share_file_test.go +++ b/tests/cli_tests/zboxcli_share_file_test.go @@ -1319,7 +1319,7 @@ func TestShareFile(testSetup *testing.T) { require.NotNil(t, err, strings.Join(output, "\n")) require.Len(t, output, 3, "download file - Unexpected output", strings.Join(output, "\n")) aggregatedOutput := strings.Join(output, " ") - require.Contains(t, aggregatedOutput, "Error cipher: message authentication failed") + require.Contains(t, aggregatedOutput, "Error while initializing encryption") }) t.RunWithTimeout("Share folder with encrypted file using auth ticket - proxy re-encryption", 5*time.Minute, func(t *test.SystemTest) { From 3475764b468b55ef7301b4def60703cc102bf58e Mon Sep 17 00:00:00 2001 From: hitenjain14 Date: Mon, 18 Nov 2024 18:31:16 +0530 Subject: [PATCH 3/4] change err message --- tests/cli_tests/zboxcli_share_file_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/cli_tests/zboxcli_share_file_test.go b/tests/cli_tests/zboxcli_share_file_test.go index 383194a04..0d4e8de1d 100644 --- a/tests/cli_tests/zboxcli_share_file_test.go +++ b/tests/cli_tests/zboxcli_share_file_test.go @@ -1317,9 +1317,9 @@ func TestShareFile(testSetup *testing.T) { }) output, err = downloadFileForWallet(t, receiverWallet, configPath, downloadParams, false) require.NotNil(t, err, strings.Join(output, "\n")) - require.Len(t, output, 3, "download file - Unexpected output", strings.Join(output, "\n")) + require.Len(t, output, 1, "download file - Unexpected output", strings.Join(output, "\n")) aggregatedOutput := strings.Join(output, " ") - require.Contains(t, aggregatedOutput, "Error while initializing encryption") + require.Contains(t, aggregatedOutput, "Error while initializing encryption invalid encryption key: Encryption key mismatch") }) t.RunWithTimeout("Share folder with encrypted file using auth ticket - proxy re-encryption", 5*time.Minute, func(t *test.SystemTest) { From a5527e789ba29e875698c5a844d1d3f8e85eaca3 Mon Sep 17 00:00:00 2001 From: hitenjain14 Date: Mon, 18 Nov 2024 19:29:38 +0530 Subject: [PATCH 4/4] fix err message --- tests/cli_tests/zboxcli_share_file_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/cli_tests/zboxcli_share_file_test.go b/tests/cli_tests/zboxcli_share_file_test.go index 0d4e8de1d..106d5f4b3 100644 --- a/tests/cli_tests/zboxcli_share_file_test.go +++ b/tests/cli_tests/zboxcli_share_file_test.go @@ -1319,7 +1319,7 @@ func TestShareFile(testSetup *testing.T) { require.NotNil(t, err, strings.Join(output, "\n")) require.Len(t, output, 1, "download file - Unexpected output", strings.Join(output, "\n")) aggregatedOutput := strings.Join(output, " ") - require.Contains(t, aggregatedOutput, "Error while initializing encryption invalid encryption key: Encryption key mismatch") + require.Contains(t, aggregatedOutput, "Error while initializing encryption invalid_encryption_key: Encryption key mismatch") }) t.RunWithTimeout("Share folder with encrypted file using auth ticket - proxy re-encryption", 5*time.Minute, func(t *test.SystemTest) {