forked from equinixmetal-archive/packngo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
email_test.go
46 lines (36 loc) · 809 Bytes
/
email_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
package packngo
import (
"testing"
)
func TestAccCreateEmail(t *testing.T) {
skipUnlessAcceptanceTestsAllowed(t)
updatedAddress := "update@domain.com"
c := setup(t)
req := &EmailRequest{
Address: "test@domain.com",
}
ret, _, err := c.Emails.Create(req)
if err != nil {
t.Fatal("Create failed", err)
}
if req.Address != ret.Address {
t.Fatal("Address not equal to", req.Address)
}
emailID := ret.ID
req.Address = updatedAddress
email, _, err := c.Emails.Get(emailID, nil)
if err != nil {
t.Fatal("Get failed", err)
}
ret, _, err = c.Emails.Update(email.ID, req)
if err != nil {
t.Fatal("Update failed:", err)
}
if req.Address == ret.Address {
t.Fatal("Address not updated")
}
_, err = c.Emails.Delete(email.ID)
if err != nil {
t.Fatal("Delete failed:", err)
}
}