-
Notifications
You must be signed in to change notification settings - Fork 0
/
preapproval_test.go
60 lines (44 loc) · 1.09 KB
/
preapproval_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
package pasdk
import (
"testing"
)
func Test_Preapproval(t *testing.T) {
if shouldRunIntegrationTests() {
return
}
request := PreapprovalRequest{
CustomerFirstName: "Test",
CustomerLastName: "Testington",
CustomerAddress1: "Test House",
CustomerPostcode: "TEST TES",
}
response, err := request.Fetch()
if err != nil {
t.Error(err)
}
if !response.Approved {
t.Error()
}
}
func Test_validatePreapprovalRequest(t *testing.T) {
request := PreapprovalRequest{}
if validatePreapprovalRequest(request).Error() != "CustomerFirstName cannot be empty" {
t.Error()
}
request.CustomerFirstName = "test"
if validatePreapprovalRequest(request).Error() != "CustomerLastName cannot be empty" {
t.Error()
}
request.CustomerLastName = "test"
if validatePreapprovalRequest(request).Error() != "CustomerAddress1 cannot be empty" {
t.Error()
}
request.CustomerAddress1 = "test"
if validatePreapprovalRequest(request).Error() != "CustomerPostcode cannot be empty" {
t.Error()
}
request.CustomerPostcode = "test"
if validatePreapprovalRequest(request) != nil {
t.Error()
}
}