This repository has been archived by the owner on Jun 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #224 from suzuki-shunsuke/test/test-graylog_input
test: add tests of graylog_ldap_setting
- Loading branch information
Showing
6 changed files
with
109 additions
and
115 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
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,17 @@ | ||
package testdata | ||
|
||
func CreateLDAPSettingMap() map[string]interface{} { | ||
return map[string]interface{}{ | ||
"enabled": true, | ||
"system_username": "", | ||
"system_password": "", | ||
"ldap_uri": "ldap://localhost:389", | ||
"use_start_tls": false, | ||
"trust_all_certificates": false, | ||
"active_directory": false, | ||
"search_base": "", | ||
"search_pattern": "", | ||
"display_name_attribute": "", | ||
"default_group": "", | ||
} | ||
} |
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,18 @@ | ||
{ | ||
"enabled": true, | ||
"system_username": "", | ||
"ldap_uri": "ldap://localhost:389", | ||
"use_start_tls": false, | ||
"trust_all_certificates": false, | ||
"active_directory": false, | ||
"search_base": "", | ||
"search_pattern": "", | ||
"display_name_attribute": "", | ||
"default_group": "", | ||
"group_mapping": null, | ||
"group_search_base": null, | ||
"group_id_attribute": null, | ||
"additional_default_groups": null, | ||
"group_search_pattern": null, | ||
"system_password_set": false | ||
} |
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,16 @@ | ||
resource "graylog_ldap_setting" "foo" { | ||
enabled = true | ||
system_username = "" | ||
system_password = "" | ||
ldap_uri = "ldap://localhost:389" | ||
use_start_tls = false | ||
trust_all_certificates = false | ||
active_directory = false | ||
search_base = "" | ||
search_pattern = "" | ||
display_name_attribute = "" | ||
default_group = "" | ||
group_search_base = "" | ||
group_id_attribute = "" | ||
group_search_pattern = "" | ||
} |
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,25 @@ | ||
package testutil | ||
|
||
func ConvertIntToFloat64(data interface{}) interface{} { | ||
switch value := data.(type) { | ||
case int: | ||
return float64(value) | ||
case map[string]interface{}: | ||
for k, v := range value { | ||
value[k] = ConvertIntToFloat64(v) | ||
} | ||
case []interface{}: | ||
for i, v := range value { | ||
value[i] = ConvertIntToFloat64(v) | ||
} | ||
} | ||
return data | ||
} | ||
|
||
func ConvertIntToFloat64OfMap(data map[string]interface{}) map[string]interface{} { | ||
m := make(map[string]interface{}, len(data)) | ||
for k, v := range data { | ||
m[k] = ConvertIntToFloat64(v) | ||
} | ||
return m | ||
} |