Skip to content

Commit

Permalink
Update "sid" identifier field
Browse files Browse the repository at this point in the history
  • Loading branch information
weppos committed Dec 12, 2016
1 parent 0b78037 commit 19eb766
Show file tree
Hide file tree
Showing 11 changed files with 51 additions and 52 deletions.
2 changes: 1 addition & 1 deletion dnsimple/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ type ServiceSetting struct {
// Service represents a Service in DNSimple.
type Service struct {
ID int `json:"id,omitempty"`
SID string `json:"sid,omitempty"`
Name string `json:"name,omitempty"`
ShortName string `json:"short_name,omitempty"`
Description string `json:"description,omitempty"`
SetupDescription string `json:"setup_description,omitempty"`
RequiresSetup bool `json:"requires_setup,omitempty"`
Expand Down
4 changes: 2 additions & 2 deletions dnsimple/services_domains_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func TestServicesService_AppliedServices(t *testing.T) {
if want, got := 1, services[0].ID; want != got {
t.Fatalf("DomainServices.AppliedServices() returned ID expected to be `%v`, got `%v`", want, got)
}
if want, got := "wordpress", services[0].ShortName; want != got {
if want, got := "wordpress", services[0].SID; want != got {
t.Fatalf("DomainServices.AppliedServices() returned ShortName expected to be `%v`, got `%v`", want, got)
}
}
Expand All @@ -60,7 +60,7 @@ func TestServicesService_ApplyService(t *testing.T) {
defer teardownMockServer()

mux.HandleFunc("/v2/1010/domains/example.com/services/service1", func(w http.ResponseWriter, r *http.Request) {
httpResponse := httpResponseFixture(t, "/applyService/created.http")
httpResponse := httpResponseFixture(t, "/applyService/success.http")

testMethod(t, r, "POST")
testHeaders(t, r)
Expand Down
6 changes: 3 additions & 3 deletions dnsimple/services_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,14 @@ func TestServicesService_Get(t *testing.T) {
service := serviceResponse.Data
wantSingle := &Service{
ID: 1,
SID: "service1",
Name: "Service 1",
ShortName: "service1",
Description: "First service example.",
SetupDescription: "",
RequiresSetup: true,
DefaultSubdomain: "",
CreatedAt: "2014-02-14T19:15:19.953Z",
UpdatedAt: "2016-03-04T09:23:27.655Z",
CreatedAt: "2014-02-14T19:15:19Z",
UpdatedAt: "2016-03-04T09:23:27Z",
Settings: []ServiceSetting{
{
Name: "username",
Expand Down
2 changes: 1 addition & 1 deletion dnsimple/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ type TemplatesService struct {
// Template represents a Template in DNSimple.
type Template struct {
ID int `json:"id,omitempty"`
SID string `json:"sid,omitempty"`
AccountID int `json:"account_id,omitempty"`
Name string `json:"name,omitempty"`
ShortName string `json:"short_name,omitempty"`
Description string `json:"description,omitempty"`
CreatedAt string `json:"created_at,omitempty"`
UpdatedAt string `json:"updated_at,omitempty"`
Expand Down
14 changes: 7 additions & 7 deletions dnsimple/templates_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func TestTemplatesService_Create(t *testing.T) {
}

template := templateResponse.Data
if want, got := 2, template.ID; want != got {
if want, got := 1, template.ID; want != got {
t.Fatalf("Templates.CreateTemplate() returned ID expected to be `%v`, got `%v`", want, got)
}
if want, got := "Beta", template.Name; want != got {
Expand Down Expand Up @@ -130,12 +130,12 @@ func TestTemplatesService_Get(t *testing.T) {
template := templateResponse.Data
wantSingle := &Template{
ID: 1,
SID: "alpha",
AccountID: 1010,
Name: "Alpha",
ShortName: "alpha",
Description: "An alpha template.",
CreatedAt: "2016-03-22T11:08:58.262Z",
UpdatedAt: "2016-03-22T11:08:58.262Z"}
CreatedAt: "2016-03-22T11:08:58Z",
UpdatedAt: "2016-03-22T11:08:58Z"}

if !reflect.DeepEqual(template, wantSingle) {
t.Fatalf("Templates.GetTemplate() returned %+v, want %+v", template, wantSingle)
Expand Down Expand Up @@ -165,12 +165,12 @@ func TestTemplatesService_UpdateTemplate(t *testing.T) {
template := templateResponse.Data
wantSingle := &Template{
ID: 1,
SID: "alpha",
AccountID: 1010,
Name: "Alpha",
ShortName: "alpha",
Description: "An alpha template.",
CreatedAt: "2016-03-22T11:08:58.262Z",
UpdatedAt: "2016-03-22T11:08:58.262Z"}
CreatedAt: "2016-03-22T11:08:58Z",
UpdatedAt: "2016-03-22T11:08:58Z"}

if !reflect.DeepEqual(template, wantSingle) {
t.Fatalf("Templates.UpdateTemplate() returned %+v, want %+v", template, wantSingle)
Expand Down
2 changes: 1 addition & 1 deletion fixtures.http/appliedServices/success.http
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ X-Permitted-Cross-Domain-Policies: none
X-XSS-Protection: 1; mode=block
Strict-Transport-Security: max-age=31536000

{"data":[{"id":1,"name":"WordPress","short_name":"wordpress","description":"Share with the world, your community, or your closest friends.","setup_description":null,"requires_setup":true,"default_subdomain":"blog","created_at":"2013-11-05T18:06:50.968Z","updated_at":"2016-03-04T09:23:27.885Z","settings":[{"name":"site","label":"Site","append":null,"description":"Your Wordpress.com subdomain","example":null,"password":false}]}],"pagination":{"current_page":1,"per_page":30,"total_entries":1,"total_pages":1}}
{"data":[{"id":1,"name":"WordPress","sid":"wordpress","description":"Share with the world, your community, or your closest friends.","setup_description":null,"requires_setup":true,"default_subdomain":"blog","created_at":"2013-11-05T18:06:50Z","updated_at":"2016-03-04T09:23:27Z","settings":[{"name":"site","label":"Site","append":null,"description":"Your Wordpress.com subdomain","example":null,"password":false}]}],"pagination":{"current_page":1,"per_page":30,"total_entries":1,"total_pages":1}}
File renamed without changes.
35 changes: 17 additions & 18 deletions fixtures.http/createTemplate/created.http
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
HTTP/1.1 201 Created
Server: nginx
Date: Tue, 22 Mar 2016 11:11:50 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Status: 200 OK
X-RateLimit-Limit: 2400
X-RateLimit-Remaining: 2396
X-RateLimit-Reset: 1458648490
ETag: W/"2d1c99cff82eace0e995d901b465bbde"
Cache-Control: max-age=0, private, must-revalidate
X-Request-Id: 774e871f-8bda-40d7-bed9-bd907e872987
X-Runtime: 0.193956
Strict-Transport-Security: max-age=31536000

{"data": {"id": 2, "name": "Beta", "account_id": 1010, "created_at": "2016-03-24T11:33:39.122Z", "short_name": "beta", "updated_at": "2016-03-24T11:33:39.122Z", "description": "A beta template."}}

HTTP/1.1 201 Created
Server: nginx
Date: Thu, 24 Mar 2016 11:09:16 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Status: 201 Created
X-RateLimit-Limit: 2400
X-RateLimit-Remaining: 2396
X-RateLimit-Reset: 1458821049
ETag: W/"c0be8a0056ccd8e0ee31a60c51256848"
Cache-Control: max-age=0, private, must-revalidate
X-Request-Id: c4ab6dd9-87d4-4244-8ec8-9187a511b89c
X-Runtime: 0.115316
Strict-Transport-Security: max-age=31536000

{"data":{"id":1,"account_id":1010,"name":"Beta","sid":"beta","description":"A beta template.","created_at":"2016-03-24T11:09:16Z","updated_at":"2016-03-24T11:09:16Z"}}
2 changes: 1 addition & 1 deletion fixtures.http/getService/success.http
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ X-Request-Id: 741b849f-dba6-4d0b-a68c-f47fe1aa3a54
X-Runtime: 0.140632
Strict-Transport-Security: max-age=31536000

{"data":{"id":1,"name":"Service 1","short_name":"service1","description":"First service example.","setup_description":null,"requires_setup":true,"default_subdomain":null,"created_at":"2014-02-14T19:15:19.953Z","updated_at":"2016-03-04T09:23:27.655Z","settings":[{"name":"username","label":"Service 1 Account Username","append":".service1.com","description":"Your Service 1 username is used to connect services to your account.","example":"username","password":false}]}}
{"data":{"id":1,"name":"Service 1","sid":"service1","description":"First service example.","setup_description":null,"requires_setup":true,"default_subdomain":null,"created_at":"2014-02-14T19:15:19Z","updated_at":"2016-03-04T09:23:27Z","settings":[{"name":"username","label":"Service 1 Account Username","append":".service1.com","description":"Your Service 1 username is used to connect services to your account.","example":"username","password":false}]}}
34 changes: 17 additions & 17 deletions fixtures.http/getTemplate/success.http
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
HTTP/1.1 200 OK
Server: nginx
Date: Tue, 22 Mar 2016 11:14:57 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Status: 200 OK
X-RateLimit-Limit: 2400
X-RateLimit-Remaining: 2394
X-RateLimit-Reset: 1458648490
ETag: W/"6a2c0c6789d853473765a5fc5662da2e"
Cache-Control: max-age=0, private, must-revalidate
X-Request-Id: 3401ffd6-730f-42c0-856c-3b270ca4b35f
X-Runtime: 0.938420
Strict-Transport-Security: max-age=31536000

{"data":{"id":1,"account_id":1010,"name":"Alpha","short_name":"alpha","description":"An alpha template.","created_at":"2016-03-22T11:08:58.262Z","updated_at":"2016-03-22T11:08:58.262Z"}}
HTTP/1.1 200 OK
Server: nginx
Date: Tue, 22 Mar 2016 11:14:57 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Status: 200 OK
X-RateLimit-Limit: 2400
X-RateLimit-Remaining: 2394
X-RateLimit-Reset: 1458648490
ETag: W/"6a2c0c6789d853473765a5fc5662da2e"
Cache-Control: max-age=0, private, must-revalidate
X-Request-Id: 3401ffd6-730f-42c0-856c-3b270ca4b35f
X-Runtime: 0.938420
Strict-Transport-Security: max-age=31536000

{"data":{"id":1,"account_id":1010,"name":"Alpha","sid":"alpha","description":"An alpha template.","created_at":"2016-03-22T11:08:58Z","updated_at":"2016-03-22T11:08:58Z"}}
2 changes: 1 addition & 1 deletion fixtures.http/updateTemplate/success.http
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ X-Request-Id: 3a7993e7-8b1e-47ce-a7a8-cc86b02904de
X-Runtime: 0.324954
Strict-Transport-Security: max-age=31536000

{"data":{"id":1,"account_id":1010,"name":"Alpha","short_name":"alpha","description":"An alpha template.","created_at":"2016-03-22T11:08:58.262Z","updated_at":"2016-03-22T11:08:58.262Z"}}
{"data":{"id":1,"account_id":1010,"name":"Alpha","sid":"alpha","description":"An alpha template.","created_at":"2016-03-22T11:08:58Z","updated_at":"2016-03-22T11:08:58Z"}}

0 comments on commit 19eb766

Please sign in to comment.