From 57c99ca18a92e67be415514e2b87eda3ea644ab3 Mon Sep 17 00:00:00 2001 From: Patrick Jones Date: Fri, 6 Aug 2021 15:07:15 -0700 Subject: [PATCH] Rearranged tests for clarity and added one additional positive test. --- .../internal/externalaccount/basecredentials_test.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/google/internal/externalaccount/basecredentials_test.go b/google/internal/externalaccount/basecredentials_test.go index 20923a7..a1342cf 100644 --- a/google/internal/externalaccount/basecredentials_test.go +++ b/google/internal/externalaccount/basecredentials_test.go @@ -102,24 +102,26 @@ func TestValidateURL(t *testing.T) { pattern []string result bool }{ + {"https://east.sts.googleapis.com", validTokenURLPatterns, true}, {"https://sts.googleapis.com", validTokenURLPatterns, true}, + {"https://sts.asfeasfesef.googleapis.com", validTokenURLPatterns, true}, + {"https://us-east-1-sts.googleapis.com", validTokenURLPatterns, true}, {"https://.sts.google.com", validTokenURLPatterns, false}, {"https://badsts.googleapis.com", validTokenURLPatterns, false}, - {"https://sts.asfeasfesef.googleapis.com", validTokenURLPatterns, true}, {"https://sts.asfe.asfesef.googleapis.com", validTokenURLPatterns, false}, {"https://sts..googleapis.com", validTokenURLPatterns, false}, {"https://-sts.googleapis.com", validTokenURLPatterns, false}, - {"https://us-east-1-sts.googleapis.com", validTokenURLPatterns, true}, {"https://us-ea.st-1-sts.googleapis.com", validTokenURLPatterns, false}, // Repeat for iamcredentials as well + {"https://east.iamcredentials.googleapis.com", validImpersonateURLPatterns, true}, {"https://iamcredentials.googleapis.com", validImpersonateURLPatterns, true}, + {"https://iamcredentials.asfeasfesef.googleapis.com", validImpersonateURLPatterns, true}, + {"https://us-east-1-iamcredentials.googleapis.com", validImpersonateURLPatterns, true}, {"https://.iamcredentials.googleapis.com", validImpersonateURLPatterns, false}, {"https://badiamcredentials.googleapis.com", validImpersonateURLPatterns, false}, - {"https://iamcredentials.asfeasfesef.googleapis.com", validImpersonateURLPatterns, true}, {"https://iamcredentials.asfe.asfesef.googleapis.com", validImpersonateURLPatterns, false}, {"https://iamcredentials..googleapis.com", validImpersonateURLPatterns, false}, {"https://-iamcredentials.googleapis.com", validImpersonateURLPatterns, false}, - {"https://us-east-1-iamcredentials.googleapis.com", validImpersonateURLPatterns, true}, {"https://us-ea.st-1-iamcredentials.googleapis.com", validImpersonateURLPatterns, false}, } for _, tt := range urlValidityTests {