Skip to content

Commit

Permalink
reformat JSON and use rfc5737 IP ranges
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobbednarz committed Feb 7, 2022
1 parent f23bce4 commit 59ad857
Showing 1 changed file with 65 additions and 67 deletions.
132 changes: 65 additions & 67 deletions teams_devices_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,36 +18,36 @@ func TestTeamsDevicesList(t *testing.T) {
assert.Equal(t, http.MethodGet, r.Method, "Expected method 'GET', got %s", r.Method)
w.Header().Set("content-type", "application/json")
fmt.Fprintf(w, `
{
"success": true,
"errors": [],
"messages": [],
"result": [
{
"id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
"user": {
"id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
"name": "John Appleseed",
"email": "[email protected]"
},
"key": "yek0SUYoOQ10vMGsIYAevozXUQpQtNFJFfFGqER/BGc=",
"device_type": "windows",
"name": "My mobile device",
"model": "MyPhone(pro-X)",
"manufacturer": "My phone corp",
"deleted": true,
"version": "1.0.0",
"serial_number": "EXAMPLEHMD6R",
"os_version": "10.0.0",
"mac_address": "00-00-5E-00-53-00",
"ip": "1.1.1.1",
"created": "2017-06-14T00:00:00Z",
"updated": "2017-06-14T00:00:00Z",
"last_seen": "2017-06-14T00:00:00Z",
"revoked_at": "2017-06-14T00:00:00Z"
}
]
}
{
"success": true,
"errors": [],
"messages": [],
"result": [
{
"id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
"user": {
"id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
"name": "John Appleseed",
"email": "[email protected]"
},
"key": "yek0SUYoOQ10vMGsIYAevozXUQpQtNFJFfFGqER/BGc=",
"device_type": "windows",
"name": "My mobile device",
"model": "MyPhone(pro-X)",
"manufacturer": "My phone corp",
"deleted": true,
"version": "1.0.0",
"serial_number": "EXAMPLEHMD6R",
"os_version": "10.0.0",
"mac_address": "00-00-5E-00-53-00",
"ip": "192.0.2.1",
"created": "2017-06-14T00:00:00Z",
"updated": "2017-06-14T00:00:00Z",
"last_seen": "2017-06-14T00:00:00Z",
"revoked_at": "2017-06-14T00:00:00Z"
}
]
}
`)
}

Expand All @@ -68,7 +68,7 @@ func TestTeamsDevicesList(t *testing.T) {
SerialNumber: "EXAMPLEHMD6R",
OSVersion: "10.0.0",
MacAddress: "00-00-5E-00-53-00",
IP: "1.1.1.1",
IP: "192.0.2.1",
Created: "2017-06-14T00:00:00Z",
Updated: "2017-06-14T00:00:00Z",
LastSeen: "2017-06-14T00:00:00Z",
Expand All @@ -94,11 +94,11 @@ func TestRevokeTeamsDevices(t *testing.T) {
assert.Equal(t, http.MethodPost, r.Method, "Expected method 'Post', got %s", r.Method)
w.Header().Set("content-type", "application/json")
fmt.Fprintf(w, `{
"result": null,
"success": true,
"errors": [],
"messages": []
}`)
"result": null,
"success": true,
"errors": [],
"messages": []
}`)
}

mux.HandleFunc("/accounts/"+testAccountID+"/devices/revoke", handler)
Expand All @@ -117,36 +117,34 @@ func TestGetTeamsDeviceDetails(t *testing.T) {
handler := func(w http.ResponseWriter, r *http.Request) {
assert.Equal(t, http.MethodGet, r.Method, "Expected method 'GET', got %s", r.Method)
w.Header().Set("content-type", "application/json")
fmt.Fprintf(w, `
{
"success": true,
"errors": [],
"messages": [],
"result":
{
"id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
"user": {
"id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
"name": "John Appleseed",
"email": "[email protected]"
},
"key": "yek0SUYoOQ10vMGsIYAevozXUQpQtNFJFfFGqER/BGc=",
"device_type": "windows",
"name": "My mobile device",
"model": "MyPhone(pro-X)",
"manufacturer": "My phone corp",
"deleted": true,
"version": "1.0.0",
"serial_number": "EXAMPLEHMD6R",
"os_version": "10.0.0",
"mac_address": "00-00-5E-00-53-00",
"ip": "1.1.1.1",
"created": "2017-06-14T00:00:00Z",
"updated": "2017-06-14T00:00:00Z",
"last_seen": "2017-06-14T00:00:00Z",
"revoked_at": "2017-06-14T00:00:00Z"
}
}
fmt.Fprintf(w, `{
"success": true,
"errors": [],
"messages": [],
"result": {
"id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
"user": {
"id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
"name": "John Appleseed",
"email": "[email protected]"
},
"key": "yek0SUYoOQ10vMGsIYAevozXUQpQtNFJFfFGqER/BGc=",
"device_type": "windows",
"name": "My mobile device",
"model": "MyPhone(pro-X)",
"manufacturer": "My phone corp",
"deleted": true,
"version": "1.0.0",
"serial_number": "EXAMPLEHMD6R",
"os_version": "10.0.0",
"mac_address": "00-00-5E-00-53-00",
"ip": "192.0.2.1",
"created": "2017-06-14T00:00:00Z",
"updated": "2017-06-14T00:00:00Z",
"last_seen": "2017-06-14T00:00:00Z",
"revoked_at": "2017-06-14T00:00:00Z"
}
}
`)
}

Expand All @@ -167,7 +165,7 @@ func TestGetTeamsDeviceDetails(t *testing.T) {
SerialNumber: "EXAMPLEHMD6R",
OSVersion: "10.0.0",
MacAddress: "00-00-5E-00-53-00",
IP: "1.1.1.1",
IP: "192.0.2.1",
Created: "2017-06-14T00:00:00Z",
Updated: "2017-06-14T00:00:00Z",
LastSeen: "2017-06-14T00:00:00Z",
Expand Down

0 comments on commit 59ad857

Please sign in to comment.