Object storage misc fixes (#82)
* Fix wrong reference * Fix schema * Fix mapFields not fetching credentials group id * Change expiration timestamp * Fix schema * Remove fields that don't come in the GET response * Add RFC3339SecondsOnly * Change expiration timestamp to not support fractional seconds * Set retry timeout * Harmonize expiration timestamp * Skip import check on credential keys * Add error check * Update docs * Change field description * Add test case, simplify test * Add test case, simplify test * Rename variable * Generate docs --------- Co-authored-by: Henrique Santos <henrique.santos@freiheit.com>
This commit is contained in:
parent
5a5ac6640c
commit
248b9834ff
11 changed files with 229 additions and 73 deletions
|
|
@ -208,3 +208,57 @@ func TestMinorVersionNumber(t *testing.T) {
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestRFC3339SecondsOnly(t *testing.T) {
|
||||
tests := []struct {
|
||||
description string
|
||||
input string
|
||||
isValid bool
|
||||
}{
|
||||
{
|
||||
"ok",
|
||||
"9999-01-02T03:04:05Z",
|
||||
true,
|
||||
},
|
||||
{
|
||||
"ok_2",
|
||||
"9999-01-02T03:04:05+06:00",
|
||||
true,
|
||||
},
|
||||
{
|
||||
"empty",
|
||||
"",
|
||||
false,
|
||||
},
|
||||
{
|
||||
"not_ok",
|
||||
"foo-bar",
|
||||
false,
|
||||
},
|
||||
{
|
||||
"with_sub_seconds",
|
||||
"9999-01-02T03:04:05.678Z",
|
||||
false,
|
||||
},
|
||||
{
|
||||
"with_sub_seconds_2",
|
||||
"9999-01-02T03:04:05.678+06:00",
|
||||
false,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.description, func(t *testing.T) {
|
||||
r := validator.StringResponse{}
|
||||
RFC3339SecondsOnly().ValidateString(context.Background(), validator.StringRequest{
|
||||
ConfigValue: types.StringValue(tt.input),
|
||||
}, &r)
|
||||
|
||||
if !tt.isValid && !r.Diagnostics.HasError() {
|
||||
t.Fatalf("Should have failed")
|
||||
}
|
||||
if tt.isValid && r.Diagnostics.HasError() {
|
||||
t.Fatalf("Should not have failed: %v", r.Diagnostics.Errors())
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue