-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* PENG-3135: add redirect, fixes * Change not found handling * PENG-3135: Update object definitions * Fix cert pagination, add links to docs * Use goimports in place of the old golint
- Loading branch information
Showing
29 changed files
with
1,362 additions
and
55 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
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 |
---|---|---|
|
@@ -6,7 +6,7 @@ fmt: | |
test: | ||
go fmt ./... | ||
go vet ./... | ||
golint ./... | ||
goimports -w . | ||
go test ./... | ||
|
||
.PHONY: all fmt test |
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
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,67 @@ | ||
package mockns1 | ||
|
||
import ( | ||
"net/http" | ||
|
||
"gopkg.in/ns1/ns1-go.v2/rest/model/redirect" | ||
) | ||
|
||
// AddRedirectListTestCase sets up a test case for the api.Client.Redirects.List() | ||
// function | ||
func (s *Service) AddRedirectListTestCase( | ||
requestHeaders, responseHeaders http.Header, | ||
response *redirect.ConfigurationList, | ||
) error { | ||
return s.AddTestCase( | ||
http.MethodGet, "/redirect", http.StatusOK, requestHeaders, | ||
responseHeaders, "", response, | ||
) | ||
} | ||
|
||
// AddRedirectGetTestCase sets up a test case for the api.Client.Redirects.Get() | ||
// function | ||
func (s *Service) AddRedirectGetTestCase( | ||
id string, | ||
requestHeaders, responseHeaders http.Header, | ||
response *redirect.Configuration, | ||
) error { | ||
return s.AddTestCase( | ||
http.MethodGet, "/redirect/"+id, http.StatusOK, requestHeaders, | ||
responseHeaders, "", response, | ||
) | ||
} | ||
|
||
// AddRedirectCreateTestCase sets up a test case for the api.Client.Redirects.Create() | ||
// function | ||
func (s *Service) AddRedirectCreateTestCase( | ||
requestHeaders, responseHeaders http.Header, | ||
request, response *redirect.Configuration, | ||
) error { | ||
return s.AddTestCase( | ||
http.MethodPut, "/redirect", http.StatusCreated, requestHeaders, | ||
responseHeaders, request, response, | ||
) | ||
} | ||
|
||
// AddRedirectUpdateTestCase sets up a test case for the api.Client.Redirects.Update() | ||
// function | ||
func (s *Service) AddRedirectUpdateTestCase( | ||
requestHeaders, responseHeaders http.Header, | ||
request, response *redirect.Configuration, | ||
) error { | ||
return s.AddTestCase( | ||
http.MethodPost, "/redirect/"+*request.ID, http.StatusOK, requestHeaders, | ||
responseHeaders, request, response, | ||
) | ||
} | ||
|
||
// AddRedirectDeleteTestCase sets up a test case for the api.Client.Redirects.Delete() | ||
// function | ||
func (s *Service) AddRedirectDeleteTestCase( | ||
id string, requestHeaders, responseHeaders http.Header, | ||
) error { | ||
return s.AddTestCase( | ||
http.MethodDelete, "/redirect/"+id, http.StatusNoContent, requestHeaders, | ||
responseHeaders, "", "", | ||
) | ||
} |
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,67 @@ | ||
package mockns1 | ||
|
||
import ( | ||
"net/http" | ||
|
||
"gopkg.in/ns1/ns1-go.v2/rest/model/redirect" | ||
) | ||
|
||
// AddRedirectCertificateListTestCase sets up a test case for the api.Client.RedirectCertificates.List() | ||
// function | ||
func (s *Service) AddRedirectCertificateListTestCase( | ||
requestHeaders, responseHeaders http.Header, | ||
response *redirect.CertificateList, | ||
) error { | ||
return s.AddTestCase( | ||
http.MethodGet, "/redirect/certificates", http.StatusOK, requestHeaders, | ||
responseHeaders, "", response, | ||
) | ||
} | ||
|
||
// AddRedirectCertificateGetTestCase sets up a test case for the api.Client.RedirectCertificates.Get() | ||
// function | ||
func (s *Service) AddRedirectCertificateGetTestCase( | ||
id string, | ||
requestHeaders, responseHeaders http.Header, | ||
response *redirect.Certificate, | ||
) error { | ||
return s.AddTestCase( | ||
http.MethodGet, "/redirect/certificates/"+id, http.StatusOK, requestHeaders, | ||
responseHeaders, "", response, | ||
) | ||
} | ||
|
||
// AddRedirectCertificateCreateTestCase sets up a test case for the api.Client.RedirectCertificates.Create() | ||
// function | ||
func (s *Service) AddRedirectCertificateCreateTestCase( | ||
requestHeaders, responseHeaders http.Header, | ||
request, response *redirect.Certificate, | ||
) error { | ||
return s.AddTestCase( | ||
http.MethodPut, "/redirect/certificates", http.StatusCreated, requestHeaders, | ||
responseHeaders, request, response, | ||
) | ||
} | ||
|
||
// AddRedirectCertificateUpdateTestCase sets up a test case for the api.Client.RedirectCertificates.Update() | ||
// function | ||
func (s *Service) AddRedirectCertificateUpdateTestCase( | ||
requestHeaders, responseHeaders http.Header, | ||
id string, response *redirect.Certificate, | ||
) error { | ||
return s.AddTestCase( | ||
http.MethodPost, "/redirect/certificates/"+id, http.StatusOK, requestHeaders, | ||
responseHeaders, "", response, | ||
) | ||
} | ||
|
||
// AddRedirectCertificateDeleteTestCase sets up a test case for the api.Client.RedirectCertificates.Delete() | ||
// function | ||
func (s *Service) AddRedirectCertificateDeleteTestCase( | ||
id string, requestHeaders, responseHeaders http.Header, | ||
) error { | ||
return s.AddTestCase( | ||
http.MethodDelete, "/redirect/certificates/"+id, http.StatusNoContent, requestHeaders, | ||
responseHeaders, "", "", | ||
) | ||
} |
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
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
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
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
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
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
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
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
Oops, something went wrong.