add new errors test case
This commit is contained in:
@@ -39,6 +39,13 @@ func TestHandleError(t *testing.T) {
|
|||||||
t.Errorf("got %v\nwant %v", actual, expected)
|
t.Errorf("got %v\nwant %v", actual, expected)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// status 21004
|
||||||
|
expected = errors.New("The shared secret you provided does not match the shared secret on file for your account.")
|
||||||
|
actual = HandleError(21004)
|
||||||
|
if !reflect.DeepEqual(actual, expected) {
|
||||||
|
t.Errorf("got %v\nwant %v", actual, expected)
|
||||||
|
}
|
||||||
|
|
||||||
// status 21005
|
// status 21005
|
||||||
expected = errors.New("The receipt server is not currently available.")
|
expected = errors.New("The receipt server is not currently available.")
|
||||||
actual = HandleError(21005)
|
actual = HandleError(21005)
|
||||||
@@ -46,6 +53,13 @@ func TestHandleError(t *testing.T) {
|
|||||||
t.Errorf("got %v\nwant %v", actual, expected)
|
t.Errorf("got %v\nwant %v", actual, expected)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// status 21006
|
||||||
|
expected = errors.New("This receipt is valid but the subscription has expired. When this status code is returned to your server, the receipt data is also decoded and returned as part of the response.")
|
||||||
|
actual = HandleError(21006)
|
||||||
|
if !reflect.DeepEqual(actual, expected) {
|
||||||
|
t.Errorf("got %v\nwant %v", actual, expected)
|
||||||
|
}
|
||||||
|
|
||||||
// status 21007
|
// status 21007
|
||||||
expected = errors.New("This receipt is from the test environment, but it was sent to the production environment for verification. Send it to the test environment instead.")
|
expected = errors.New("This receipt is from the test environment, but it was sent to the production environment for verification. Send it to the test environment instead.")
|
||||||
actual = HandleError(21007)
|
actual = HandleError(21007)
|
||||||
@@ -60,6 +74,20 @@ func TestHandleError(t *testing.T) {
|
|||||||
t.Errorf("got %v\nwant %v", actual, expected)
|
t.Errorf("got %v\nwant %v", actual, expected)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// status 21010
|
||||||
|
expected = errors.New("This receipt could not be authorized. Treat this the same as if a purchase was never made.")
|
||||||
|
actual = HandleError(21010)
|
||||||
|
if !reflect.DeepEqual(actual, expected) {
|
||||||
|
t.Errorf("got %v\nwant %v", actual, expected)
|
||||||
|
}
|
||||||
|
|
||||||
|
// status 21100 - 21199
|
||||||
|
expected = errors.New("Internal data access error.")
|
||||||
|
actual = HandleError(21155)
|
||||||
|
if !reflect.DeepEqual(actual, expected) {
|
||||||
|
t.Errorf("got %v\nwant %v", actual, expected)
|
||||||
|
}
|
||||||
|
|
||||||
// status unknown
|
// status unknown
|
||||||
expected = errors.New("An unknown error occurred")
|
expected = errors.New("An unknown error occurred")
|
||||||
actual = HandleError(100)
|
actual = HandleError(100)
|
||||||
|
|||||||
Reference in New Issue
Block a user