-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow Google storage endpoints without http/s (#179)
Fix Google URL check
- Loading branch information
1 parent
735b2ca
commit 1395dfa
Showing
2 changed files
with
37 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package s3 | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestIsGoogleEndpoint_StorageGoogleapis(t *testing.T) { | ||
endpoint := "storage.googleapis.com" | ||
result := isGoogleEndpoint(endpoint) | ||
assert.True(t, result, "Expected true for Google Cloud Storage endpoint") | ||
} | ||
|
||
func TestIsGoogleEndpoint_HttpsStorageGoogleapis(t *testing.T) { | ||
endpoint := "https://storage.googleapis.com" | ||
result := isGoogleEndpoint(endpoint) | ||
assert.True(t, result, "Expected true for Google Cloud Storage endpoint") | ||
} | ||
|
||
func TestIsGoogleEndpoint_False(t *testing.T) { | ||
endpoint := "https://s3.amazonaws.com/my-bucket" | ||
result := isGoogleEndpoint(endpoint) | ||
assert.False(t, result, "Expected false for non-Google endpoint") | ||
} | ||
|
||
func TestIsGoogleEndpoint_Empty(t *testing.T) { | ||
endpoint := "" | ||
result := isGoogleEndpoint(endpoint) | ||
assert.False(t, result, "Expected false for empty endpoint") | ||
} |