Skip to content

Commit

Permalink
chore: update unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sweatybridge committed Dec 10, 2024
1 parent 1ce4233 commit 82d5da2
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 39 deletions.
17 changes: 5 additions & 12 deletions pkg/config/auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,24 +186,20 @@ func TestHookDiff(t *testing.T) {
Enabled: false,
URI: "pg-functions://postgres/public/verifyMFA",
},
PasswordVerificationAttempt: &hookConfig{
Enabled: false,
URI: "http://example.com",
Secrets: "test-secret",
},
PasswordVerificationAttempt: nil,
}
// Run test
diff, err := c.DiffWithRemote("", v1API.AuthConfigResponse{
HookCustomAccessTokenEnabled: cast.Ptr(true),
HookCustomAccessTokenUri: cast.Ptr("http://example.com"),
HookCustomAccessTokenSecrets: cast.Ptr("ce62bb9bcced294fd4afe668f8ab3b50a89cf433093c526fffa3d0e46bf55252"),
HookSendSmsEnabled: cast.Ptr(true),
HookSendSmsUri: cast.Ptr(""),
HookSendSmsSecrets: cast.Ptr("b613679a0814d9ec772f95d778c35fc5ff1697c493715653c6c712144292c5ad"),
HookSendSmsUri: cast.Ptr("https://example.com"),
HookSendSmsSecrets: cast.Ptr("ce62bb9bcced294fd4afe668f8ab3b50a89cf433093c526fffa3d0e46bf55252"),
HookSendEmailEnabled: cast.Ptr(true),
HookSendEmailUri: cast.Ptr("pg-functions://postgres/public/sendEmail"),
HookMfaVerificationAttemptEnabled: cast.Ptr(true),
HookMfaVerificationAttemptUri: cast.Ptr(""),
HookMfaVerificationAttemptUri: cast.Ptr("pg-functions://postgres/public/verifyMFA"),
HookPasswordVerificationAttemptEnabled: cast.Ptr(true),
HookPasswordVerificationAttemptUri: cast.Ptr("https://example.com"),
HookPasswordVerificationAttemptSecrets: cast.Ptr("ce62bb9bcced294fd4afe668f8ab3b50a89cf433093c526fffa3d0e46bf55252"),
Expand Down Expand Up @@ -234,10 +230,7 @@ func TestHookDiff(t *testing.T) {
Enabled: true,
URI: "pg-functions://postgres/public/verifyMFA",
},
PasswordVerificationAttempt: &hookConfig{
Enabled: true,
URI: "pg-functions://postgres/public/verifyPassword",
},
PasswordVerificationAttempt: nil,
}
// Run test
diff, err := c.DiffWithRemote("", v1API.AuthConfigResponse{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ diff remote[auth] local[auth]
+password_requirements = "lower_upper_letters_digits_symbols"

[hook]
[hook.mfa_verification_attempt]

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
diff remote[auth] local[auth]
--- remote[auth]
+++ local[auth]
@@ -51,13 +51,13 @@
@@ -31,13 +31,13 @@
inactivity_timeout = "0s"

[email]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
diff remote[auth] local[auth]
--- remote[auth]
+++ local[auth]
@@ -51,35 +51,43 @@
@@ -31,35 +31,43 @@
inactivity_timeout = "0s"

[email]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
diff remote[auth] local[auth]
--- remote[auth]
+++ local[auth]
@@ -91,7 +91,7 @@
@@ -71,7 +71,7 @@

[external]
[external.apple]
Expand All @@ -10,7 +10,7 @@ diff remote[auth] local[auth]
client_id = "test-client-1,test-client-2"
secret = "hash:ce62bb9bcced294fd4afe668f8ab3b50a89cf433093c526fffa3d0e46bf55252"
url = ""
@@ -98,9 +98,9 @@
@@ -78,9 +78,9 @@
redirect_uri = ""
skip_nonce_check = false
[external.azure]
Expand All @@ -23,7 +23,7 @@ diff remote[auth] local[auth]
url = ""
redirect_uri = ""
skip_nonce_check = false
@@ -147,7 +147,7 @@
@@ -127,7 +127,7 @@
redirect_uri = ""
skip_nonce_check = false
[external.google]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
diff remote[auth] local[auth]
--- remote[auth]
+++ local[auth]
@@ -11,23 +11,23 @@
@@ -11,19 +11,19 @@

[hook]
[hook.mfa_verification_attempt]
-enabled = true
+enabled = false
uri = "pg-functions://postgres/public/verifyMFA"
secrets = ""
[hook.password_verification_attempt]
-enabled = true
+enabled = false
uri = "http://example.com"
secrets = "test-secret"
[hook.custom_access_token]
-enabled = true
+enabled = false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
diff remote[auth] local[auth]
--- remote[auth]
+++ local[auth]
@@ -11,25 +11,25 @@
@@ -11,21 +11,21 @@

[hook]
[hook.mfa_verification_attempt]
-enabled = false
+enabled = true
uri = "pg-functions://postgres/public/verifyMFA"
secrets = "hash:"
[hook.password_verification_attempt]
-enabled = false
-uri = ""
+enabled = true
+uri = "pg-functions://postgres/public/verifyPassword"
secrets = "hash:"
[hook.custom_access_token]
-enabled = false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff remote[auth] local[auth]
--- remote[auth]
+++ local[auth]
@@ -32,16 +32,16 @@
secrets = ""
@@ -12,16 +12,16 @@
[hook]

[mfa]
-max_enrolled_factors = 10
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
diff remote[auth] local[auth]
--- remote[auth]
+++ local[auth]
@@ -60,7 +60,7 @@
@@ -40,7 +40,7 @@
otp_expiry = 0

[sms]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
diff remote[auth] local[auth]
--- remote[auth]
+++ local[auth]
@@ -60,12 +60,12 @@
@@ -40,12 +40,12 @@
otp_expiry = 0

[sms]
Expand All @@ -19,7 +19,7 @@ diff remote[auth] local[auth]
account_sid = ""
message_service_sid = ""
auth_token = ""
@@ -88,8 +88,6 @@
@@ -68,8 +68,6 @@
api_key = ""
api_secret = ""
[sms.test_otp]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
diff remote[auth] local[auth]
--- remote[auth]
+++ local[auth]
@@ -60,12 +60,12 @@
@@ -40,12 +40,12 @@
otp_expiry = 0

[sms]
Expand All @@ -19,7 +19,7 @@ diff remote[auth] local[auth]
account_sid = ""
message_service_sid = ""
auth_token = ""
@@ -75,9 +75,9 @@
@@ -55,9 +55,9 @@
message_service_sid = ""
auth_token = ""
[sms.messagebird]
Expand All @@ -32,7 +32,7 @@ diff remote[auth] local[auth]
[sms.textlocal]
enabled = false
sender = ""
@@ -88,6 +88,7 @@
@@ -68,6 +68,7 @@
api_key = ""
api_secret = ""
[sms.test_otp]
Expand Down

0 comments on commit 82d5da2

Please sign in to comment.