-
Notifications
You must be signed in to change notification settings - Fork 0
/
datatypes_test.go
64 lines (59 loc) · 1.31 KB
/
datatypes_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package testsuite
import (
"fmt"
"testing"
)
func ExampleIsDateTime() {
fmt.Println(IsDateTime("2008-01-23T04:56:22Z"))
// Output:
// true
}
func TestIsBase64(t *testing.T) {
for _, example := range []string{
"",
"Zg==",
"Zm9v",
"Zm9vYg==",
"Zm9vYmE=",
"Zm9vYmFy",
"MY======", // base 32
"MZXQ====", // base 32
} {
if !IsBase64(example) {
t.Error(example)
}
}
}
var exampleSCIMResource = `{
"schemas": [
"urn:ietf:params:scim:schemas:core:2.0:User",
"urn:ietf:params:scim:schemas:extension:enterprise:2.0:User"
],
"id": "2819c223-7f76-453a-413861904646",
"externalId": "701984",
"userName": "[email protected]",
"name": {
"formatted": "Ms. Barbara J Jensen, III",
"familyName": "Jensen",
"givenName": "Barbara",
"middleName": "Jane",
"honorificPrefix": "Ms.",
"honorificSuffix": "III"
},
"urn:ietf:params:scim:schemas:extension:enterprise:2.0:User": {
"employeeNumber": "701984",
"costCenter": "4130"
},
"meta": {
"resourceType": "User",
"created": "2010-01-23T04:56:22Z",
"lastModified": "2011-05-13T04:42:34Z",
"version": "W\/\"3694e05e9dff591\"",
"location": "https://example.com/v2/Users/2819c223-7f76-453a-413861904646"
}
}`
func TestIsObject(t *testing.T) {
if !IsObject(exampleSCIMResource) {
t.Error()
}
}