[#3364] added mailcow OAuth2 provider

Co-authored-by: thisni1s <nils@jn2p.de>
This commit is contained in:
Gani Georgiev
2023-10-14 14:46:01 +03:00
parent 69983bff5e
commit 01e33c07fe
45 changed files with 3332 additions and 3219 deletions

View File

@@ -75,6 +75,8 @@ func TestSettingsValidate(t *testing.T) {
s.YandexAuth.ClientId = ""
s.PatreonAuth.Enabled = true
s.PatreonAuth.ClientId = ""
s.MailcowAuth.Enabled = true
s.MailcowAuth.ClientId = ""
// check if Validate() is triggering the members validate methods.
err := s.Validate()
@@ -117,6 +119,7 @@ func TestSettingsValidate(t *testing.T) {
`"vkAuth":{`,
`"yandexAuth":{`,
`"patreonAuth":{`,
`"mailcowAuth":{`,
}
errBytes, _ := json.Marshal(err)
@@ -192,6 +195,8 @@ func TestSettingsMerge(t *testing.T) {
s2.YandexAuth.ClientId = "yandex_test"
s2.PatreonAuth.Enabled = true
s2.PatreonAuth.ClientId = "patreon_test"
s2.MailcowAuth.Enabled = true
s2.MailcowAuth.ClientId = "mailcow_test"
if err := s1.Merge(s2); err != nil {
t.Fatal(err)
@@ -283,6 +288,7 @@ func TestSettingsRedactClone(t *testing.T) {
s1.VKAuth.ClientSecret = testSecret
s1.YandexAuth.ClientSecret = testSecret
s1.PatreonAuth.ClientSecret = testSecret
s1.MailcowAuth.ClientSecret = testSecret
s1Bytes, err := json.Marshal(s1)
if err != nil {
@@ -342,6 +348,7 @@ func TestNamedAuthProviderConfigs(t *testing.T) {
s.VKAuth.ClientId = "vk_test"
s.YandexAuth.ClientId = "yandex_test"
s.PatreonAuth.ClientId = "patreon_test"
s.MailcowAuth.ClientId = "mailcow_test"
result := s.NamedAuthProviderConfigs()
@@ -374,6 +381,7 @@ func TestNamedAuthProviderConfigs(t *testing.T) {
`"vk":{"enabled":false,"clientId":"vk_test"`,
`"yandex":{"enabled":false,"clientId":"yandex_test"`,
`"patreon":{"enabled":false,"clientId":"patreon_test"`,
`"mailcow":{"enabled":false,"clientId":"mailcow_test"`,
}
for _, p := range expectedParts {
if !strings.Contains(encodedStr, p) {