-
Notifications
You must be signed in to change notification settings - Fork 461
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b897ada
commit 57f5c33
Showing
2 changed files
with
37 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package stripe | ||
|
||
import ( | ||
"encoding/json" | ||
"testing" | ||
) | ||
|
||
func TestApplicationUnmarshal(t *testing.T) { | ||
applicationData := map[string]interface{}{ | ||
"id": "ca_1234", | ||
"name": "My Application Name", | ||
} | ||
|
||
bytes, err := json.Marshal(&applicationData) | ||
if err != nil { | ||
t.Error(err) | ||
} | ||
|
||
var application Application | ||
err = json.Unmarshal(bytes, &application) | ||
if err != nil { | ||
t.Error(err) | ||
} | ||
|
||
if application.ID != "ca_1234" { | ||
t.Errorf("Problem deserializing application, got ID %v", application.ID) | ||
} | ||
|
||
if application.Name != "My Application Name" { | ||
t.Errorf("Problem deserializing application, got name %v", application.Name) | ||
} | ||
} |
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