[#2762] added Yandex OAuth2 provider

Co-authored-by: Valentine <xb2w1z@gmail.com>
This commit is contained in:
Gani Georgiev
2023-06-23 14:13:43 +03:00
parent 0a61db6efd
commit 435eca6f35
39 changed files with 152 additions and 37 deletions

View File

@@ -71,6 +71,8 @@ func TestSettingsValidate(t *testing.T) {
s.InstagramAuth.ClientId = ""
s.VKAuth.Enabled = true
s.VKAuth.ClientId = ""
s.YandexAuth.Enabled = true
s.YandexAuth.ClientId = ""
// check if Validate() is triggering the members validate methods.
err := s.Validate()
@@ -111,6 +113,7 @@ func TestSettingsValidate(t *testing.T) {
`"appleAuth":{`,
`"instagramAuth":{`,
`"vkAuth":{`,
`"yandexAuth":{`,
}
errBytes, _ := json.Marshal(err)
@@ -182,6 +185,8 @@ func TestSettingsMerge(t *testing.T) {
s2.InstagramAuth.ClientId = "instagram_test"
s2.VKAuth.Enabled = true
s2.VKAuth.ClientId = "vk_test"
s2.YandexAuth.Enabled = true
s2.YandexAuth.ClientId = "yandex_test"
if err := s1.Merge(s2); err != nil {
t.Fatal(err)
@@ -271,6 +276,7 @@ func TestSettingsRedactClone(t *testing.T) {
s1.AppleAuth.ClientSecret = testSecret
s1.InstagramAuth.ClientSecret = testSecret
s1.VKAuth.ClientSecret = testSecret
s1.YandexAuth.ClientSecret = testSecret
s1Bytes, err := json.Marshal(s1)
if err != nil {
@@ -328,6 +334,7 @@ func TestNamedAuthProviderConfigs(t *testing.T) {
s.AppleAuth.ClientId = "apple_test"
s.InstagramAuth.ClientId = "instagram_test"
s.VKAuth.ClientId = "vk_test"
s.YandexAuth.ClientId = "yandex_test"
result := s.NamedAuthProviderConfigs()
@@ -358,6 +365,7 @@ func TestNamedAuthProviderConfigs(t *testing.T) {
`"apple":{"enabled":false,"clientId":"apple_test"`,
`"instagram":{"enabled":false,"clientId":"instagram_test"`,
`"vk":{"enabled":false,"clientId":"vk_test"`,
`"yandex":{"enabled":false,"clientId":"yandex_test"`,
}
for _, p := range expectedParts {
if !strings.Contains(encodedStr, p) {