Repository: xanzy/go-gitlab
Pull request #1015 (2020-12-22 11:11:50)

Add golangci-lint
Add golangci-lint

Starting with minimimal, permissive configuration
to do not fail CI build and let us able to follow
code changes

These are the most minimalistic linters which are good candidate to introduce `golangci-lint`:
- Fix govet errors reported by golangci-lint
- Fix goconst errors reported by golangci-lint
- Fix staticcheck errors reported by golangci-lint
- Fix misspell errors reported by golangci-lint
- Fix whitespace errors reported by golangci-lint

Signed-off-by: Alex Szakaly <alex.szakaly@gmail.com>

alex1989hu: > Before continuing my review, lets exclude the `errcheck` and with that all the `//nolint:errcheck` comments. I'm open to adding the rest of the checks...
> 
> Also lets define all the `exampleXXX` constants in one location. I would suggest adding them just below the imports in `gitlab_test.go`.

To be honest, I do not clearly understand what you asked me to do. Please tell me which one you thought
- disable linter OR
- modify the code to check if any error

For the second part, I moved all constant - I have just pushed commit: **Move constants for test to common place**
svanharmelen: I mean to disable (remove) the `errcheck` linter. And when we don't use the `errcheck` linter, we can also remove all the `//nolint:errcheck` comments again.
alex1989hu: > I mean to disable (remove) the `errcheck` linter. And when we don't use the `errcheck` linter, we can also remove all the `//nolint:errcheck` comments again.

In the meantime I fixed them and write a summary. There are only two items which needs rework but it requires to have deeper knowledge of this library.

If you are still unhappy with the change, I can create an issue and put reference after `nolint`, but on the other side I fixed most of them.

Updated the PR and fixed them, here is some description:
- ./gitlab.go:392:			if reset, _ := strconv.ParseInt(v, 10, 64); reset > 0 { //nolint:errcheck
   - **This requires rework.**, because it will end up in `func newClient(options ...ClientOptionFunc) (*Client, error)`: `Backoff:      c.retryHTTPBackoff,`
- ./gitlab.go:627:	c.configureLimiterOnce.Do(func() { c.configureLimiter() }) //nolint:errcheck
   - *Intended, see the already existing comment in the code*
- ./gitlab.go:674:	defer resp.Body.Close() //nolint:errcheck
   - *Intended, no other option.*
- ./gitlab.go:754:	path, _ := url.QueryUnescape(e.Response.Request.URL.Path) //nolint:errcheck
   - **This requires rework.**
- ./projects_test.go:298:	defer os.Remove(tf.Name()) //nolint:errcheck
   - *Intended, no other option.*
- ./access_requests_test.go:251:		defer r.Body.Close() //nolint:errcheck
   - *Intended, no other option.*
- ./access_requests_test.go:311:		defer r.Body.Close() //nolint:errcheck
   - *Intended, no other option.*
- ./projects.go:1141:	defer f.Close() //nolint:errcheck
   - *Intended, no other option.*
svanharmelen: Sorry @alex1989hu, but I don't like this approach. I appreciate that you want to add some checks to make the package better tested, but let's not change the way this package is written.

I think the only places were the errors are ignored, is where they can actually be ignored without any danger of it causing issues for users of this package. So please just remove the error check and revert all related changes.

As for the location of the constants, lets see how it looks when the rest is reverted and the diff is a bit cleaner again.

Thanks!
alex1989hu: > Sorry @alex1989hu, but I don't like this approach. I appreciate that you want to add some checks to make the package better tested, but let's not change the way this package is written.
> 
> I think the only places were the errors are ignored, is where they can actually be ignored without any danger of it causing issues for users of this package. So please just remove the error check and revert all related changes.
> 
> As for the location of the constants, lets see how it looks when the rest is reverted and the diff is a bit cleaner again.
> 
> Thanks!

Done 👍 

Patch:
diff --git a/.golangci.yml b/.golangci.yml
new file mode 100644
index 0000000..fad8e86
--- /dev/null
+++ b/.golangci.yml
@@ -0,0 +1,58 @@
+# This file contains all available configuration options
+# with their default values.
+
+# Options for analysis running
+run:
+  concurrency: 4
+  timeout: 10m
+  issues-exit-code: 1
+  # Include test files or not, default is true
+  tests: true
+
+# Output configuration options
+output:
+  format: line-number
+
+# All available settings of specific linters
+linters-settings:
+  misspell:
+    locale: US
+    ignore-words:
+    - noteable
+  unused:
+    # Treat code as a program (not a library) and report unused exported identifiers
+    check-exported: false
+
+linters:
+  enable:
+    - asciicheck
+    - deadcode
+    - dogsled
+    - exportloopref
+    - goconst
+    - golint
+    - gosimple
+    - govet
+    - ineffassign
+    - megacheck
+    - misspell
+    - nakedret
+    - nolintlint
+    - staticcheck
+    - structcheck
+    - typecheck
+    - unconvert
+    - unused
+    - varcheck
+    - whitespace
+  disable:
+    - errcheck
+  disable-all: false
+  fast: false
+
+issues:
+  # Maximum issues count per one linter (set to 0 to disable)
+  max-issues-per-linter: 0
+
+  # Maximum count of issues with the same text (set to 0 to disable)
+  max-same-issues: 0
diff --git a/.travis.yml b/.travis.yml
index 1b84a3a..5e422eb 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -10,11 +10,11 @@ go:
   - 1.x
   - master
 
-before_script:
-  - go get golang.org/x/lint/golint
-  - golint -set_exit_status
-  - go vet -v
+before_install:
+  - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/v1.35.0/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.35.0
+
 script:
+  - golangci-lint run
   - go test -v
 
 matrix:
diff --git a/event_parsing.go b/event_parsing.go
index c57b3f1..675d681 100644
--- a/event_parsing.go
+++ b/event_parsing.go
@@ -141,7 +141,7 @@ func ParseSystemhook(payload []byte) (event interface{}, err error) {
 		event = &UserTeamSystemEvent{}
 	default:
 		switch e.ObjectKind {
-		case "merge_request":
+		case string(MergeRequestEventTargetType):
 			event = &MergeEvent{}
 		default:
 			return nil, fmt.Errorf("unexpected system hook type %s", e.EventName)
@@ -207,7 +207,7 @@ func ParseWebhook(eventType EventType, payload []byte) (event interface{}, err e
 			return nil, err
 		}
 
-		if note.ObjectKind != "note" {
+		if note.ObjectKind != string(NoteEventTargetType) {
 			return nil, fmt.Errorf("unexpected object kind %s", note.ObjectKind)
 		}
 
diff --git a/gitlab.go b/gitlab.go
index 7ae2919..5bab400 100644
--- a/gitlab.go
+++ b/gitlab.go
@@ -428,7 +428,7 @@ func (c *Client) configureLimiter() error {
 	if v := resp.Header.Get(headerRateLimit); v != "" {
 		if rateLimit, _ := strconv.ParseFloat(v, 64); rateLimit > 0 {
 			// The rate limit is based on requests per minute, so for our limiter to
-			// work correctly we devide the limit by 60 to get the limit per second.
+			// work correctly we divide the limit by 60 to get the limit per second.
 			rateLimit /= 60
 			// Configure the limit and burst using a split of 2/3 for the limit and
 			// 1/3 for the burst. This enables clients to burst 1/3 of the allowed
diff --git a/project_mirror.go b/project_mirror.go
index aa7a1aa..e246a43 100644
--- a/project_mirror.go
+++ b/project_mirror.go
@@ -68,7 +68,6 @@ func (s *ProjectMirrorService) ListProjectMirror(pid interface{}, options ...Req
 	}
 
 	return pm, resp, err
-
 }
 
 // AddProjectMirrorOptions contains the properties requires to create
diff --git a/users.go b/users.go
index 3b8dc1b..a3bff6f 100644
--- a/users.go
+++ b/users.go
@@ -942,10 +942,10 @@ func (s *UsersService) SetUserStatus(opt *UserStatusOptions, options ...RequestO
 // GitLab API docs:
 // https://docs.gitlab.com/ee/api/users.html#user-memberships-admin-only
 type UserMembership struct {
-	SourceID    int              `json:"source_id"`
-	SourceName  string           `json:"source_name"`
-	SourceType  string           `json:"source_type"`
-	AccessLevel AccessLevelValue `json:"access_level"`
+	SourceID    int    `json:"source_id"`
+	SourceName  string `json:"source_name"`
+	SourceType  string `json:"source_type"`
+	AccessLevel string `json:"access_level"`
 }
 
 // GetUserMembershipOptions represents the options available to query user memberships.


Test patch:
diff --git a/access_requests_test.go b/access_requests_test.go
index 53936a4..4d2d6ba 100644
--- a/access_requests_test.go
+++ b/access_requests_test.go
@@ -58,23 +58,23 @@ func TestListProjectAccessRequests(t *testing.T) {
 
 	requests, resp, err := client.AccessRequests.ListProjectAccessRequests(1, nil)
 	assert.NoError(t, err)
-	assert.Equal(t, expected, requests)
 	assert.NotNil(t, resp)
+	assert.Equal(t, expected, requests)
 
 	requests, resp, err = client.AccessRequests.ListProjectAccessRequests(1.5, nil)
 	assert.EqualError(t, err, "invalid ID type 1.5, the ID must be an int or a string")
-	assert.Nil(t, requests)
 	assert.Nil(t, resp)
+	assert.Nil(t, requests)
 
 	requests, resp, err = client.AccessRequests.ListProjectAccessRequests(2, nil)
 	assert.Error(t, err)
-	assert.Nil(t, requests)
 	assert.Equal(t, http.StatusNotFound, resp.StatusCode)
+	assert.Nil(t, requests)
 
 	requests, resp, err = client.AccessRequests.ListProjectAccessRequests(1, nil, errorOption)
 	assert.EqualError(t, err, "RequestOptionFunc returns an error")
-	assert.Nil(t, requests)
 	assert.Nil(t, resp)
+	assert.Nil(t, requests)
 }
 
 func TestListGroupAccessRequests(t *testing.T) {
@@ -125,23 +125,23 @@ func TestListGroupAccessRequests(t *testing.T) {
 
 	requests, resp, err := client.AccessRequests.ListGroupAccessRequests(1, nil)
 	assert.NoError(t, err)
-	assert.Equal(t, expected, requests)
 	assert.NotNil(t, resp)
+	assert.Equal(t, expected, requests)
 
 	requests, resp, err = client.AccessRequests.ListGroupAccessRequests(1.5, nil)
 	assert.EqualError(t, err, "invalid ID type 1.5, the ID must be an int or a string")
-	assert.Nil(t, requests)
 	assert.Nil(t, resp)
+	assert.Nil(t, requests)
 
 	requests, resp, err = client.AccessRequests.ListGroupAccessRequests(2, nil)
 	assert.Error(t, err)
-	assert.Nil(t, requests)
 	assert.Equal(t, http.StatusNotFound, resp.StatusCode)
+	assert.Nil(t, requests)
 
 	requests, resp, err = client.AccessRequests.ListGroupAccessRequests(1, nil, errorOption)
 	assert.EqualError(t, err, "RequestOptionFunc returns an error")
-	assert.Nil(t, requests)
 	assert.Nil(t, resp)
+	assert.Nil(t, requests)
 }
 
 func TestRequestProjectAccess(t *testing.T) {
@@ -172,23 +172,23 @@ func TestRequestProjectAccess(t *testing.T) {
 
 	accessRequest, resp, err := client.AccessRequests.RequestProjectAccess(1, nil)
 	assert.NoError(t, err)
-	assert.Equal(t, expected, accessRequest)
 	assert.NotNil(t, resp)
+	assert.Equal(t, expected, accessRequest)
 
 	accessRequest, resp, err = client.AccessRequests.RequestProjectAccess(1.5, nil)
 	assert.EqualError(t, err, "invalid ID type 1.5, the ID must be an int or a string")
-	assert.Nil(t, accessRequest)
 	assert.Nil(t, resp)
+	assert.Nil(t, accessRequest)
 
 	accessRequest, resp, err = client.AccessRequests.RequestProjectAccess(2, nil)
 	assert.Error(t, err)
-	assert.Nil(t, accessRequest)
 	assert.Equal(t, http.StatusNotFound, resp.StatusCode)
+	assert.Nil(t, accessRequest)
 
 	accessRequest, resp, err = client.AccessRequests.RequestProjectAccess(1, nil, errorOption)
 	assert.EqualError(t, err, "RequestOptionFunc returns an error")
-	assert.Nil(t, accessRequest)
 	assert.Nil(t, resp)
+	assert.Nil(t, accessRequest)
 }
 
 func TestRequestGroupAccess(t *testing.T) {
@@ -219,23 +219,23 @@ func TestRequestGroupAccess(t *testing.T) {
 
 	accessRequest, resp, err := client.AccessRequests.RequestGroupAccess(1, nil)
 	assert.NoError(t, err)
-	assert.Equal(t, expected, accessRequest)
 	assert.NotNil(t, resp)
+	assert.Equal(t, expected, accessRequest)
 
 	accessRequest, resp, err = client.AccessRequests.RequestGroupAccess(1.5, nil)
 	assert.EqualError(t, err, "invalid ID type 1.5, the ID must be an int or a string")
-	assert.Nil(t, accessRequest)
 	assert.Nil(t, resp)
+	assert.Nil(t, accessRequest)
 
 	accessRequest, resp, err = client.AccessRequests.RequestGroupAccess(2, nil)
 	assert.Error(t, err)
-	assert.Nil(t, accessRequest)
 	assert.Equal(t, http.StatusNotFound, resp.StatusCode)
+	assert.Nil(t, accessRequest)
 
 	accessRequest, resp, err = client.AccessRequests.RequestGroupAccess(1, nil, errorOption)
 	assert.EqualError(t, err, "RequestOptionFunc returns an error")
-	assert.Nil(t, accessRequest)
 	assert.Nil(t, resp)
+	assert.Nil(t, accessRequest)
 }
 
 func TestApproveProjectAccessRequest(t *testing.T) {
@@ -279,23 +279,23 @@ func TestApproveProjectAccessRequest(t *testing.T) {
 
 	request, resp, err := client.AccessRequests.ApproveProjectAccessRequest(1, 10, opt)
 	assert.NoError(t, err)
-	assert.Equal(t, expected, request)
 	assert.NotNil(t, resp)
+	assert.Equal(t, expected, request)
 
 	request, resp, err = client.AccessRequests.ApproveProjectAccessRequest(1.5, 10, opt)
 	assert.EqualError(t, err, "invalid ID type 1.5, the ID must be an int or a string")
-	assert.Nil(t, request)
 	assert.Nil(t, resp)
+	assert.Nil(t, request)
 
 	request, resp, err = client.AccessRequests.ApproveProjectAccessRequest(2, 10, opt)
 	assert.Error(t, err)
-	assert.Nil(t, request)
 	assert.Equal(t, http.StatusNotFound, resp.StatusCode)
+	assert.Nil(t, request)
 
 	request, resp, err = client.AccessRequests.ApproveProjectAccessRequest(1, 10, opt, errorOption)
 	assert.EqualError(t, err, "RequestOptionFunc returns an error")
-	assert.Nil(t, request)
 	assert.Nil(t, resp)
+	assert.Nil(t, request)
 }
 
 func TestApproveGroupAccessRequest(t *testing.T) {
@@ -339,23 +339,23 @@ func TestApproveGroupAccessRequest(t *testing.T) {
 
 	request, resp, err := client.AccessRequests.ApproveGroupAccessRequest(1, 10, opt)
 	assert.NoError(t, err)
-	assert.Equal(t, expected, request)
 	assert.NotNil(t, resp)
+	assert.Equal(t, expected, request)
 
 	request, resp, err = client.AccessRequests.ApproveGroupAccessRequest(1.5, 10, opt)
 	assert.EqualError(t, err, "invalid ID type 1.5, the ID must be an int or a string")
-	assert.Nil(t, request)
 	assert.Nil(t, resp)
+	assert.Nil(t, request)
 
 	request, resp, err = client.AccessRequests.ApproveGroupAccessRequest(2, 10, opt)
 	assert.Error(t, err)
-	assert.Nil(t, request)
 	assert.Equal(t, http.StatusNotFound, resp.StatusCode)
+	assert.Nil(t, request)
 
 	request, resp, err = client.AccessRequests.ApproveGroupAccessRequest(1, 10, opt, errorOption)
 	assert.EqualError(t, err, "RequestOptionFunc returns an error")
-	assert.Nil(t, request)
 	assert.Nil(t, resp)
+	assert.Nil(t, request)
 }
 
 func TestDenyProjectAccessRequest(t *testing.T) {
diff --git a/branches_test.go b/branches_test.go
index f673cc9..d35b664 100644
--- a/branches_test.go
+++ b/branches_test.go
@@ -34,11 +34,11 @@ func TestGetBranch(t *testing.T) {
 		CanPush:            true,
 		Commit: &Commit{
 			AuthorEmail:    "john@example.com",
-			AuthorName:     "John Smith",
+			AuthorName:     exampleEventUserName,
 			AuthoredDate:   &authoredDate,
 			CommittedDate:  &committedDate,
 			CommitterEmail: "john@example.com",
-			CommitterName:  "John Smith",
+			CommitterName:  exampleEventUserName,
 			ID:             "7b5c3cc8be40ee161ae89a06bba6229da1032a0c",
 			ShortID:        "7b5c3cc",
 			Title:          "add projects API",
diff --git a/event_parsing_webhook_test.go b/event_parsing_webhook_test.go
index cd3e15a..8e0af2f 100644
--- a/event_parsing_webhook_test.go
+++ b/event_parsing_webhook_test.go
@@ -41,8 +41,8 @@ func TestParsePushHook(t *testing.T) {
 		t.Errorf("ProjectID is %v, want %v", event.ProjectID, 15)
 	}
 
-	if event.UserName != "John Smith" {
-		t.Errorf("Username is %s, want %s", event.UserName, "John Smith")
+	if event.UserName != exampleEventUserName {
+		t.Errorf("Username is %s, want %s", event.UserName, exampleEventUserName)
 	}
 
 	if event.Commits[0] == nil || event.Commits[0].Timestamp == nil {
@@ -75,8 +75,8 @@ func TestParseTagHook(t *testing.T) {
 		t.Errorf("ProjectID is %v, want %v", event.ProjectID, 1)
 	}
 
-	if event.UserName != "John Smith" {
-		t.Errorf("Username is %s, want %s", event.UserName, "John Smith")
+	if event.UserName != exampleEventUserName {
+		t.Errorf("Username is %s, want %s", event.UserName, exampleEventUserName)
 	}
 
 	if event.Ref != "refs/tags/v1.0.0" {
@@ -136,8 +136,8 @@ func TestParseCommitCommentHook(t *testing.T) {
 		t.Errorf("Expected CommitCommentEvent, but parsing produced %T", parsedEvent)
 	}
 
-	if event.ObjectKind != "note" {
-		t.Errorf("ObjectKind is %v, want %v", event.ObjectKind, "note")
+	if event.ObjectKind != string(NoteEventTargetType) {
+		t.Errorf("ObjectKind is %v, want %v", event.ObjectKind, NoteEventTargetType)
 	}
 
 	if event.ProjectID != 5 {
@@ -166,7 +166,7 @@ func TestParseMergeRequestCommentHook(t *testing.T) {
 		t.Errorf("Expected MergeCommentEvent, but parsing produced %T", parsedEvent)
 	}
 
-	if event.ObjectKind != "note" {
+	if event.ObjectKind != string(NoteEventTargetType) {
 		t.Errorf("ObjectKind is %v, want %v", event.ObjectKind, "note")
 	}
 
@@ -196,8 +196,8 @@ func TestParseIssueCommentHook(t *testing.T) {
 		t.Errorf("Expected IssueCommentEvent, but parsing produced %T", parsedEvent)
 	}
 
-	if event.ObjectKind != "note" {
-		t.Errorf("ObjectKind is %v, want %v", event.ObjectKind, "note")
+	if event.ObjectKind != string(NoteEventTargetType) {
+		t.Errorf("ObjectKind is %v, want %v", event.ObjectKind, NoteEventTargetType)
 	}
 
 	if event.ProjectID != 5 {
@@ -226,8 +226,8 @@ func TestParseSnippetCommentHook(t *testing.T) {
 		t.Errorf("Expected SnippetCommentEvent, but parsing produced %T", parsedEvent)
 	}
 
-	if event.ObjectKind != "note" {
-		t.Errorf("ObjectKind is %v, want %v", event.ObjectKind, "note")
+	if event.ObjectKind != string(NoteEventTargetType) {
+		t.Errorf("ObjectKind is %v, want %v", event.ObjectKind, NoteEventTargetType)
 	}
 
 	if event.ProjectID != 5 {
diff --git a/event_webhook_types_test.go b/event_webhook_types_test.go
index d1d7ae4..3c2b3e9 100644
--- a/event_webhook_types_test.go
+++ b/event_webhook_types_test.go
@@ -22,8 +22,8 @@ func TestPushEventUnmarshal(t *testing.T) {
 		t.Errorf("ProjectID is %v, want %v", event.ProjectID, 15)
 	}
 
-	if event.UserName != "John Smith" {
-		t.Errorf("Username is %s, want %s", event.UserName, "John Smith")
+	if event.UserName != exampleEventUserName {
+		t.Errorf("Username is %s, want %s", event.UserName, exampleEventUserName)
 	}
 
 	if event.Commits[0] == nil || event.Commits[0].Timestamp == nil {
@@ -153,24 +153,24 @@ func TestMergeEventUnmarshalFromGroup(t *testing.T) {
 		t.Errorf("User.Username is %v, want %v", event.User.Username, "root")
 	}
 
-	if event.Project.Name != "example-project" {
-		t.Errorf("Project.Name is %v, want %v", event.Project.Name, "example-project")
+	if event.Project.Name != exampleProjectName {
+		t.Errorf("Project.Name is %v, want %v", event.Project.Name, exampleProjectName)
 	}
 
 	if event.ObjectAttributes.ID != 15917 {
 		t.Errorf("ObjectAttributes.ID is %v, want %v", event.ObjectAttributes.ID, 15917)
 	}
 
-	if event.ObjectAttributes.Source.Name != "example-project" {
-		t.Errorf("ObjectAttributes.Source.Name is %v, want %v", event.ObjectAttributes.Source.Name, "example-project")
+	if event.ObjectAttributes.Source.Name != exampleProjectName {
+		t.Errorf("ObjectAttributes.Source.Name is %v, want %v", event.ObjectAttributes.Source.Name, exampleProjectName)
 	}
 
 	if event.ObjectAttributes.LastCommit.Author.Email != "test.user@mail.com" {
 		t.Errorf("ObjectAttributes.LastCommit.Author.Email is %v, want %v", event.ObjectAttributes.LastCommit.Author.Email, "test.user@mail.com")
 	}
 
-	if event.Repository.Name != "example-project" {
-		t.Errorf("Repository.Name is %v, want %v", event.Repository.Name, "example-project")
+	if event.Repository.Name != exampleProjectName {
+		t.Errorf("Repository.Name is %v, want %v", event.Repository.Name, exampleProjectName)
 	}
 
 	if event.Assignee.Username != "root" {
diff --git a/fixtures_test.go b/fixtures_test.go
new file mode 100644
index 0000000..ba87507
--- /dev/null
+++ b/fixtures_test.go
@@ -0,0 +1,229 @@
+package gitlab
+
+const (
+	// exampleDetailResponse provides fixture for Runners tests.
+	exampleDetailResponse = `{
+		"active": true,
+		"architecture": null,
+		"description": "test-1-20150125-test",
+		"run_untagged": true,
+		"id": 6,
+		"is_shared": false,
+		"contacted_at": "2016-01-25T16:39:48.066Z",
+		"name": null,
+		"online": true,
+		"status": "online",
+		"platform": null,
+		"projects": [
+			{
+				"id": 1,
+				"name": "GitLab Community Edition",
+				"name_with_namespace": "GitLab.org / GitLab Community Edition",
+				"path": "gitlab-ce",
+				"path_with_namespace": "gitlab-org/gitlab-ce"
+			}
+		],
+		"token": "205086a8e3b9a2b818ffac9b89d102",
+		"revision": null,
+		"tag_list": [
+			"ruby",
+			"mysql"
+		],
+		"version": null,
+		"access_level": "ref_protected",
+		"maximum_timeout": 3600,
+		"locked": false
+	}`
+
+	// exampleEventUserName provides a fixture for a event username.
+	exampleEventUserName = "John Smith"
+
+	// exampleProjectName provides a fixture for a project name.
+	exampleProjectName = "example-project"
+
+	// exampleRegisterNewRunner provides fixture for Runners tests.
+	exampleRegisterNewRunner = `{
+		"id": 12345,
+		"token": "6337ff461c94fd3fa32ba3b1ff4125"
+	}`
+
+	// exampleReleaseLink provides fixture for Release Links tests.
+	exampleReleaseLink = `{
+		"id":1,
+		"name":"awesome-v0.2.dmg",
+		"url":"http://192.168.10.15:3000",
+		"external":true
+	}`
+
+	// exampleReleaseLinkList provides fixture for Release Links tests.
+	exampleReleaseLinkList = `[
+		{
+			"id": 2,
+			"name": "awesome-v0.2.msi",
+			"url": "http://192.168.10.15:3000/msi",
+			"external": true
+		},
+		{
+			"id": 1,
+			"name": "awesome-v0.2.dmg",
+			"url": "http://192.168.10.15:3000",
+			"external": true
+		}
+	]`
+
+	// exampleReleaseListResponse provides fixture for Releases tests.
+	exampleReleaseListResponse = `[
+		{
+			"tag_name": "v0.2",
+			"description": "description",
+			"name": "Awesome app v0.2 beta",
+			"description_html": "html",
+			"created_at": "2019-01-03T01:56:19.539Z",
+			"author": {
+			"id": 1,
+			"name": "Administrator",
+			"username": "root",
+			"state": "active",
+			"avatar_url": "https://www.gravatar.com/avatar",
+			"web_url": "http://localhost:3000/root"
+			},
+			"commit": {
+			"id": "079e90101242458910cccd35eab0e211dfc359c0",
+			"short_id": "079e9010",
+			"title": "Update README.md",
+			"created_at": "2019-01-03T01:55:38.000Z",
+			"parent_ids": [
+				"f8d3d94cbd347e924aa7b715845e439d00e80ca4"
+			],
+			"message": "Update README.md",
+			"author_name": "Administrator",
+			"author_email": "admin@example.com",
+			"authored_date": "2019-01-03T01:55:38.000Z",
+			"committer_name": "Administrator",
+			"committer_email": "admin@example.com",
+			"committed_date": "2019-01-03T01:55:38.000Z"
+			},
+			"assets": {
+			"count": 4,
+			"sources": [
+				{
+				"format": "zip",
+				"url": "http://localhost:3000/archive/v0.2/awesome-app-v0.2.zip"
+				},
+				{
+				"format": "tar.gz",
+				"url": "http://localhost:3000/archive/v0.2/awesome-app-v0.2.tar.gz"
+				}
+			],
+			"links": [
+				{
+				"id": 2,
+				"name": "awesome-v0.2.msi",
+				"url": "http://192.168.10.15:3000/msi",
+				"external": true
+				},
+				{
+				"id": 1,
+				"name": "awesome-v0.2.dmg",
+				"url": "http://192.168.10.15:3000",
+				"external": true
+				}
+			]
+			}
+		},
+		{
+			"tag_name": "v0.1",
+			"description": "description",
+			"name": "Awesome app v0.1 alpha",
+			"description_html": "description_html",
+			"created_at": "2019-01-03T01:55:18.203Z",
+			"author": {
+			"id": 1,
+			"name": "Administrator",
+			"username": "root",
+			"state": "active",
+			"avatar_url": "https://www.gravatar.com/avatar",
+			"web_url": "http://localhost:3000/root"
+			},
+			"commit": {
+			"id": "f8d3d94cbd347e924aa7b715845e439d00e80ca4",
+			"short_id": "f8d3d94c",
+			"title": "Initial commit",
+			"created_at": "2019-01-03T01:53:28.000Z",
+			"parent_ids": [],
+			"message": "Initial commit",
+			"author_name": "Administrator",
+			"author_email": "admin@example.com",
+			"authored_date": "2019-01-03T01:53:28.000Z",
+			"committer_name": "Administrator",
+			"committer_email": "admin@example.com",
+			"committed_date": "2019-01-03T01:53:28.000Z"
+			},
+			"assets": {
+			"count": 2,
+			"sources": [
+				{
+				"format": "zip",
+				"url": "http://localhost:3000/archive/v0.1/awesome-app-v0.1.zip"
+				},
+				{
+				"format": "tar.gz",
+				"url": "http://localhost:3000/archive/v0.1/awesome-app-v0.1.tar.gz"
+				}
+			],
+			"links": []
+			}
+		}
+	]`
+
+	// exampleReleaseName provides a fixture for a release name.
+	exampleReleaseName = "awesome-v0.2.dmg"
+
+	// exampleReleaseResponse provides fixture for Releases tests.
+	exampleReleaseResponse = `{
+		"tag_name": "v0.1",
+		"description": "description",
+		"name": "Awesome app v0.1 alpha",
+		"description_html": "description_html",
+		"created_at": "2019-01-03T01:55:18.203Z",
+		"author": {
+			"id": 1,
+			"name": "Administrator",
+			"username": "root",
+			"state": "active",
+			"avatar_url": "https://www.gravatar.com/avatar/",
+			"web_url": "http://localhost:3000/root"
+		},
+		"commit": {
+			"id": "f8d3d94cbd347e924aa7b715845e439d00e80ca4",
+			"short_id": "f8d3d94c",
+			"title": "Initial commit",
+			"created_at": "2019-01-03T01:53:28.000Z",
+			"parent_ids": [],
+			"message": "Initial commit",
+			"author_name": "Administrator",
+			"author_email": "admin@example.com",
+			"authored_date": "2019-01-03T01:53:28.000Z",
+			"committer_name": "Administrator",
+			"committer_email": "admin@example.com",
+			"committed_date": "2019-01-03T01:53:28.000Z"
+		},
+		"assets": {
+			"count": 2,
+			"sources": [
+			{
+				"format": "zip",
+				"url": "http://localhost:3000/archive/v0.1/awesome-app-v0.1.zip"
+			},
+			{
+				"format": "tar.gz",
+				"url": "http://localhost:3000/archive/v0.1/awesome-app-v0.1.tar.gz"
+			}
+			],
+			"links": []
+		}
+	}`
+
+	// exampleTagName provides a fixture for a tag name.
+	exampleTagName = "v0.1"
+)
diff --git a/group_labels_test.go b/group_labels_test.go
index f2d80fc..9a9bca8 100644
--- a/group_labels_test.go
+++ b/group_labels_test.go
@@ -131,7 +131,6 @@ func TestListGroupLabels(t *testing.T) {
 	label, _, err := client.GroupLabels.ListGroupLabels("1", o)
 	if err != nil {
 		t.Log(err.Error() == "invalid ID type 1.1, the ID must be an int or a string")
-
 	}
 	want := []*GroupLabel{{ID: 5, Name: "bug", Color: "#d9534f", Description: "Bug reported by user", OpenIssuesCount: 1, ClosedIssuesCount: 0, OpenMergeRequestsCount: 1, Subscribed: true}}
 	if !reflect.DeepEqual(want, label) {
diff --git a/groups_badges_test.go b/groups_badges_test.go
index 44ba4f4..51a3a02 100644
--- a/groups_badges_test.go
+++ b/groups_badges_test.go
@@ -114,5 +114,4 @@ func TestRemoveGroupBadge(t *testing.T) {
 	if got != want {
 		t.Errorf("GroupsBadges.DeleteGroupBadge returned %d, want %d", got, want)
 	}
-
 }
diff --git a/groups_test.go b/groups_test.go
index c8e1902..204125c 100644
--- a/groups_test.go
+++ b/groups_test.go
@@ -94,7 +94,6 @@ func TestTransferGroup(t *testing.T) {
 	if !reflect.DeepEqual(group, want) {
 		t.Errorf("Groups.TransferGroup returned %+v, want %+v", group, want)
 	}
-
 }
 
 func TestDeleteGroup(t *testing.T) {
diff --git a/keys_test.go b/keys_test.go
index c0acc72..bfeee7b 100644
--- a/keys_test.go
+++ b/keys_test.go
@@ -58,7 +58,7 @@ func TestGetKeyWithUser(t *testing.T) {
 			ID:               25,
 			Username:         "john_smith",
 			Email:            "john@example.com",
-			Name:             "John Smith",
+			Name:             exampleEventUserName,
 			State:            "active",
 			Bio:              "",
 			Location:         "",
diff --git a/labels_test.go b/labels_test.go
index acdd2cf..5eae95c 100644
--- a/labels_test.go
+++ b/labels_test.go
@@ -136,7 +136,6 @@ func TestListLabels(t *testing.T) {
 	label, _, err := client.Labels.ListLabels("1", o)
 	if err != nil {
 		t.Log(err.Error() == "invalid ID type 1.1, the ID must be an int or a string")
-
 	}
 	want := []*Label{{ID: 5, Name: "bug", Color: "#d9534f", Description: "Bug reported by user", OpenIssuesCount: 1, ClosedIssuesCount: 0, OpenMergeRequestsCount: 1, Subscribed: true}}
 	if !reflect.DeepEqual(want, label) {
@@ -156,7 +155,6 @@ func TestGetLabel(t *testing.T) {
 	label, _, err := client.Labels.GetLabel("1", 5)
 	if err != nil {
 		t.Log(err)
-
 	}
 	want := &Label{ID: 5, Name: "bug", Color: "#d9534f", Description: "Bug reported by user", OpenIssuesCount: 1, ClosedIssuesCount: 0, OpenMergeRequestsCount: 1, Subscribed: true}
 	if !reflect.DeepEqual(want, label) {
diff --git a/releaselinks_test.go b/releaselinks_test.go
index 4cff9f2..4a3e4f2 100644
--- a/releaselinks_test.go
+++ b/releaselinks_test.go
@@ -6,21 +6,6 @@ import (
 	"testing"
 )
 
-const exampleReleaseLinkList = `[
-        {
-          "id": 2,
-          "name": "awesome-v0.2.msi",
-          "url": "http://192.168.10.15:3000/msi",
-          "external": true
-        },
-        {
-          "id": 1,
-          "name": "awesome-v0.2.dmg",
-          "url": "http://192.168.10.15:3000",
-          "external": true
-        }
-]`
-
 func TestReleaseLinksService_ListReleaseLinks(t *testing.T) {
 	mux, server, client := setup(t)
 	defer teardown(server)
@@ -32,7 +17,7 @@ func TestReleaseLinksService_ListReleaseLinks(t *testing.T) {
 		})
 
 	releaseLinks, _, err := client.ReleaseLinks.ListReleaseLinks(
-		1, "v0.1", &ListReleaseLinksOptions{},
+		1, exampleTagName, &ListReleaseLinksOptions{},
 	)
 	if err != nil {
 		t.Error(err)
@@ -46,13 +31,6 @@ func TestReleaseLinksService_ListReleaseLinks(t *testing.T) {
 	}
 }
 
-const exampleReleaseLink = `{
-        "id":1,
-        "name":"awesome-v0.2.dmg",
-        "url":"http://192.168.10.15:3000",
-        "external":true
- }`
-
 func TestReleaseLinksService_CreateReleaseLink(t *testing.T) {
 	mux, server, client := setup(t)
 	defer teardown(server)
@@ -64,16 +42,16 @@ func TestReleaseLinksService_CreateReleaseLink(t *testing.T) {
 		})
 
 	releaseLink, _, err := client.ReleaseLinks.CreateReleaseLink(
-		1, "v0.1",
+		1, exampleTagName,
 		&CreateReleaseLinkOptions{
-			Name: String("awesome-v0.2.dmg"),
+			Name: String(exampleReleaseName),
 			URL:  String("http://192.168.10.15:3000"),
 		})
 	if err != nil {
 		t.Error(err)
 	}
-	if releaseLink.Name != "awesome-v0.2.dmg" {
-		t.Errorf("release link name, expected '%s', got '%s'", "awesome-v0.2.dmg",
+	if releaseLink.Name != exampleReleaseName {
+		t.Errorf("release link name, expected '%s', got '%s'", exampleReleaseName,
 			releaseLink.Name)
 	}
 }
@@ -88,12 +66,12 @@ func TestReleaseLinksService_GetReleaseLink(t *testing.T) {
 			fmt.Fprint(w, exampleReleaseLink)
 		})
 
-	releaseLink, _, err := client.ReleaseLinks.GetReleaseLink(1, "v0.1", 1)
+	releaseLink, _, err := client.ReleaseLinks.GetReleaseLink(1, exampleTagName, 1)
 	if err != nil {
 		t.Error(err)
 	}
-	if releaseLink.Name != "awesome-v0.2.dmg" {
-		t.Errorf("release link name, expected '%s', got '%s'", "awesome-v0.2.dmg",
+	if releaseLink.Name != exampleReleaseName {
+		t.Errorf("release link name, expected '%s', got '%s'", exampleReleaseName,
 			releaseLink.Name)
 	}
 }
@@ -109,15 +87,15 @@ func TestReleaseLinksService_UpdateReleaseLink(t *testing.T) {
 		})
 
 	releaseLink, _, err := client.ReleaseLinks.UpdateReleaseLink(
-		1, "v0.1", 1,
+		1, exampleTagName, 1,
 		&UpdateReleaseLinkOptions{
-			Name: String("awesome-v0.2.dmg"),
+			Name: String(exampleReleaseName),
 		})
 	if err != nil {
 		t.Error(err)
 	}
-	if releaseLink.Name != "awesome-v0.2.dmg" {
-		t.Errorf("release link name, expected '%s', got '%s'", "awesome-v0.2.dmg",
+	if releaseLink.Name != exampleReleaseName {
+		t.Errorf("release link name, expected '%s', got '%s'", exampleReleaseName,
 			releaseLink.Name)
 	}
 }
@@ -132,12 +110,12 @@ func TestReleaseLinksService_DeleteReleaseLink(t *testing.T) {
 			fmt.Fprint(w, exampleReleaseLink)
 		})
 
-	releaseLink, _, err := client.ReleaseLinks.DeleteReleaseLink(1, "v0.1", 1)
+	releaseLink, _, err := client.ReleaseLinks.DeleteReleaseLink(1, exampleTagName, 1)
 	if err != nil {
 		t.Error(err)
 	}
-	if releaseLink.Name != "awesome-v0.2.dmg" {
-		t.Errorf("release link name, expected '%s', got '%s'", "awesome-v0.2.dmg",
+	if releaseLink.Name != exampleReleaseName {
+		t.Errorf("release link name, expected '%s', got '%s'", exampleReleaseName,
 			releaseLink.Name)
 	}
 }
diff --git a/releases_test.go b/releases_test.go
index 66d84b2..69a2636 100644
--- a/releases_test.go
+++ b/releases_test.go
@@ -9,110 +9,6 @@ import (
 	"time"
 )
 
-const exampleReleaseListRsp = `[
-        {
-          "tag_name": "v0.2",
-          "description": "description",
-          "name": "Awesome app v0.2 beta",
-          "description_html": "html",
-          "created_at": "2019-01-03T01:56:19.539Z",
-          "author": {
-            "id": 1,
-            "name": "Administrator",
-            "username": "root",
-            "state": "active",
-            "avatar_url": "https://www.gravatar.com/avatar",
-            "web_url": "http://localhost:3000/root"
-          },
-          "commit": {
-            "id": "079e90101242458910cccd35eab0e211dfc359c0",
-            "short_id": "079e9010",
-            "title": "Update README.md",
-            "created_at": "2019-01-03T01:55:38.000Z",
-            "parent_ids": [
-              "f8d3d94cbd347e924aa7b715845e439d00e80ca4"
-            ],
-            "message": "Update README.md",
-            "author_name": "Administrator",
-            "author_email": "admin@example.com",
-            "authored_date": "2019-01-03T01:55:38.000Z",
-            "committer_name": "Administrator",
-            "committer_email": "admin@example.com",
-            "committed_date": "2019-01-03T01:55:38.000Z"
-          },
-          "assets": {
-            "count": 4,
-            "sources": [
-              {
-                "format": "zip",
-                "url": "http://localhost:3000/archive/v0.2/awesome-app-v0.2.zip"
-              },
-              {
-                "format": "tar.gz",
-                "url": "http://localhost:3000/archive/v0.2/awesome-app-v0.2.tar.gz"
-              }
-            ],
-            "links": [
-              {
-                "id": 2,
-                "name": "awesome-v0.2.msi",
-                "url": "http://192.168.10.15:3000/msi",
-                "external": true
-              },
-              {
-                "id": 1,
-                "name": "awesome-v0.2.dmg",
-                "url": "http://192.168.10.15:3000",
-                "external": true
-              }
-            ]
-          }
-        },
-        {
-          "tag_name": "v0.1",
-          "description": "description",
-          "name": "Awesome app v0.1 alpha",
-          "description_html": "description_html",
-          "created_at": "2019-01-03T01:55:18.203Z",
-          "author": {
-            "id": 1,
-            "name": "Administrator",
-            "username": "root",
-            "state": "active",
-            "avatar_url": "https://www.gravatar.com/avatar",
-            "web_url": "http://localhost:3000/root"
-          },
-          "commit": {
-            "id": "f8d3d94cbd347e924aa7b715845e439d00e80ca4",
-            "short_id": "f8d3d94c",
-            "title": "Initial commit",
-            "created_at": "2019-01-03T01:53:28.000Z",
-            "parent_ids": [],
-            "message": "Initial commit",
-            "author_name": "Administrator",
-            "author_email": "admin@example.com",
-            "authored_date": "2019-01-03T01:53:28.000Z",
-            "committer_name": "Administrator",
-            "committer_email": "admin@example.com",
-            "committed_date": "2019-01-03T01:53:28.000Z"
-          },
-          "assets": {
-            "count": 2,
-            "sources": [
-              {
-                "format": "zip",
-                "url": "http://localhost:3000/archive/v0.1/awesome-app-v0.1.zip"
-              },
-              {
-                "format": "tar.gz",
-                "url": "http://localhost:3000/archive/v0.1/awesome-app-v0.1.tar.gz"
-              }
-            ],
-            "links": []
-          }
-        }
-]`
-
 func TestReleasesService_ListReleases(t *testing.T) {
 	mux, server, client := setup(t)
 	defer teardown(server)
@@ -120,7 +16,7 @@ func TestReleasesService_ListReleases(t *testing.T) {
 	mux.HandleFunc("/api/v4/projects/1/releases",
 		func(w http.ResponseWriter, r *http.Request) {
 			testMethod(t, r, "GET")
-			fmt.Fprint(w, exampleReleaseListRsp)
+			fmt.Fprint(w, exampleReleaseListResponse)
 		})
 
 	opt := &ListReleasesOptions{}
@@ -133,50 +29,6 @@ func TestReleasesService_ListReleases(t *testing.T) {
 	}
 }
 
-const exampleReleaseRsp = `{
-        "tag_name": "v0.1",
-        "description": "description",
-        "name": "Awesome app v0.1 alpha",
-        "description_html": "description_html",
-        "created_at": "2019-01-03T01:55:18.203Z",
-        "author": {
-          "id": 1,
-          "name": "Administrator",
-          "username": "root",
-          "state": "active",
-          "avatar_url": "https://www.gravatar.com/avatar/",
-          "web_url": "http://localhost:3000/root"
-        },
-        "commit": {
-          "id": "f8d3d94cbd347e924aa7b715845e439d00e80ca4",
-          "short_id": "f8d3d94c",
-          "title": "Initial commit",
-          "created_at": "2019-01-03T01:53:28.000Z",
-          "parent_ids": [],
-          "message": "Initial commit",
-          "author_name": "Administrator",
-          "author_email": "admin@example.com",
-          "authored_date": "2019-01-03T01:53:28.000Z",
-          "committer_name": "Administrator",
-          "committer_email": "admin@example.com",
-          "committed_date": "2019-01-03T01:53:28.000Z"
-        },
-        "assets": {
-          "count": 2,
-          "sources": [
-            {
-              "format": "zip",
-              "url": "http://localhost:3000/archive/v0.1/awesome-app-v0.1.zip"
-            },
-            {
-              "format": "tar.gz",
-              "url": "http://localhost:3000/archive/v0.1/awesome-app-v0.1.tar.gz"
-            }
-          ],
-          "links": []
-        }
-}`
-
 func TestReleasesService_GetRelease(t *testing.T) {
 	mux, server, client := setup(t)
 	defer teardown(server)
@@ -184,15 +36,15 @@ func TestReleasesService_GetRelease(t *testing.T) {
 	mux.HandleFunc("/api/v4/projects/1/releases/v0.1",
 		func(w http.ResponseWriter, r *http.Request) {
 			testMethod(t, r, "GET")
-			fmt.Fprint(w, exampleReleaseRsp)
+			fmt.Fprint(w, exampleReleaseResponse)
 		})
 
-	release, _, err := client.Releases.GetRelease(1, "v0.1")
+	release, _, err := client.Releases.GetRelease(1, exampleTagName)
 	if err != nil {
 		t.Error(err)
 	}
-	if release.TagName != "v0.1" {
-		t.Errorf("expected tag v0.1, got %s", release.TagName)
+	if release.TagName != exampleTagName {
+		t.Errorf("expected tag %s, got %s", exampleTagName, release.TagName)
 	}
 }
 
@@ -207,9 +59,9 @@ func TestReleasesService_CreateRelease(t *testing.T) {
 			if err != nil {
 				t.Fatalf("unable to read request body")
 			}
-			if !strings.Contains(string(b), "v0.1") {
-				t.Errorf("expected request body to contain v0.1, got %s",
-					string(b))
+			if !strings.Contains(string(b), exampleTagName) {
+				t.Errorf("expected request body to contain %s, got %s",
+					exampleTagName, string(b))
 			}
 			if strings.Contains(string(b), "assets") {
 				t.Errorf("expected request body not to have assets, got %s",
@@ -223,12 +75,12 @@ func TestReleasesService_CreateRelease(t *testing.T) {
 				t.Errorf("expected request body not to have released_at, got %s",
 					string(b))
 			}
-			fmt.Fprint(w, exampleReleaseRsp)
+			fmt.Fprint(w, exampleReleaseResponse)
 		})
 
 	opts := &CreateReleaseOptions{
 		Name:        String("name"),
-		TagName:     String("v0.1"),
+		TagName:     String(exampleTagName),
 		Description: String("Description"),
 	}
 
@@ -236,8 +88,8 @@ func TestReleasesService_CreateRelease(t *testing.T) {
 	if err != nil {
 		t.Error(err)
 	}
-	if release.TagName != "v0.1" {
-		t.Errorf("expected tag v0.1, got %s", release.TagName)
+	if release.TagName != exampleTagName {
+		t.Errorf("expected tag %s, got %s", exampleTagName, release.TagName)
 	}
 }
 
@@ -252,9 +104,9 @@ func TestReleasesService_CreateReleaseWithAsset(t *testing.T) {
 			if err != nil {
 				t.Fatalf("unable to read request body")
 			}
-			if !strings.Contains(string(b), "v0.1") {
-				t.Errorf("expected request body to contain v0.1, got %s",
-					string(b))
+			if !strings.Contains(string(b), exampleTagName) {
+				t.Errorf("expected request body to contain %s, got %s",
+					exampleTagName, string(b))
 			}
 			if !strings.Contains(string(b), "assets") {
 				t.Errorf("expected request body to have assets, got %s",
@@ -268,12 +120,12 @@ func TestReleasesService_CreateReleaseWithAsset(t *testing.T) {
 				t.Errorf("expected request body not to have released_at, got %s",
 					string(b))
 			}
-			fmt.Fprint(w, exampleReleaseRsp)
+			fmt.Fprint(w, exampleReleaseResponse)
 		})
 
 	opts := &CreateReleaseOptions{
 		Name:        String("name"),
-		TagName:     String("v0.1"),
+		TagName:     String(exampleTagName),
 		Description: String("Description"),
 		Assets: &ReleaseAssets{
 			Links: []*ReleaseAssetLink{
@@ -286,8 +138,8 @@ func TestReleasesService_CreateReleaseWithAsset(t *testing.T) {
 	if err != nil {
 		t.Error(err)
 	}
-	if release.TagName != "v0.1" {
-		t.Errorf("expected tag v0.1, got %s", release.TagName)
+	if release.TagName != exampleTagName {
+		t.Errorf("expected tag %s, got %s", exampleTagName, release.TagName)
 	}
 }
 
@@ -302,9 +154,9 @@ func TestReleasesService_CreateReleaseWithMilestones(t *testing.T) {
 			if err != nil {
 				t.Fatalf("unable to read request body")
 			}
-			if !strings.Contains(string(b), "v0.1") {
-				t.Errorf("expected request body to contain v0.1, got %s",
-					string(b))
+			if !strings.Contains(string(b), exampleTagName) {
+				t.Errorf("expected request body to contain %s, got %s",
+					exampleTagName, string(b))
 			}
 			if strings.Contains(string(b), "assets") {
 				t.Errorf("expected request body not to have assets, got %s",
@@ -318,22 +170,22 @@ func TestReleasesService_CreateReleaseWithMilestones(t *testing.T) {
 				t.Errorf("expected request body not to have released_at, got %s",
 					string(b))
 			}
-			fmt.Fprint(w, exampleReleaseRsp)
+			fmt.Fprint(w, exampleReleaseResponse)
 		})
 
 	opts := &CreateReleaseOptions{
 		Name:        String("name"),
-		TagName:     String("v0.1"),
+		TagName:     String(exampleTagName),
 		Description: String("Description"),
-		Milestones:  []string{"v0.1", "v0.1.0"},
+		Milestones:  []string{exampleTagName, "v0.1.0"},
 	}
 
 	release, _, err := client.Releases.CreateRelease(1, opts)
 	if err != nil {
 		t.Error(err)
 	}
-	if release.TagName != "v0.1" {
-		t.Errorf("expected tag v0.1, got %s", release.TagName)
+	if release.TagName != exampleTagName {
+		t.Errorf("expected tag %s, got %s", exampleTagName, release.TagName)
 	}
 }
 
@@ -348,9 +200,9 @@ func TestReleasesService_CreateReleaseWithReleasedAt(t *testing.T) {
 			if err != nil {
 				t.Fatalf("unable to read request body")
 			}
-			if !strings.Contains(string(b), "v0.1") {
-				t.Errorf("expected request body to contain v0.1, got %s",
-					string(b))
+			if !strings.Contains(string(b), exampleTagName) {
+				t.Errorf("expected request body to contain %s, got %s",
+					exampleTagName, string(b))
 			}
 			if strings.Contains(string(b), "assets") {
 				t.Errorf("expected request body not to have assets, got %s",
@@ -364,12 +216,12 @@ func TestReleasesService_CreateReleaseWithReleasedAt(t *testing.T) {
 				t.Errorf("expected request body to have released_at, got %s",
 					string(b))
 			}
-			fmt.Fprint(w, exampleReleaseRsp)
+			fmt.Fprint(w, exampleReleaseResponse)
 		})
 
 	opts := &CreateReleaseOptions{
 		Name:        String("name"),
-		TagName:     String("v0.1"),
+		TagName:     String(exampleTagName),
 		Description: String("Description"),
 		ReleasedAt:  &time.Time{},
 	}
@@ -378,8 +230,8 @@ func TestReleasesService_CreateReleaseWithReleasedAt(t *testing.T) {
 	if err != nil {
 		t.Error(err)
 	}
-	if release.TagName != "v0.1" {
-		t.Errorf("expected tag v0.1, got %s", release.TagName)
+	if release.TagName != exampleTagName {
+		t.Errorf("expected tag %s, got %s", exampleTagName, release.TagName)
 	}
 }
 
@@ -402,7 +254,7 @@ func TestReleasesService_UpdateRelease(t *testing.T) {
 				t.Errorf("expected request body not to have released_at, got %s",
 					string(b))
 			}
-			fmt.Fprint(w, exampleReleaseRsp)
+			fmt.Fprint(w, exampleReleaseResponse)
 		})
 
 	opts := &UpdateReleaseOptions{
@@ -410,14 +262,13 @@ func TestReleasesService_UpdateRelease(t *testing.T) {
 		Description: String("Description"),
 	}
 
-	release, _, err := client.Releases.UpdateRelease(1, "v0.1", opts)
+	release, _, err := client.Releases.UpdateRelease(1, exampleTagName, opts)
 	if err != nil {
 		t.Error(err)
 	}
-	if release.TagName != "v0.1" {
-		t.Errorf("expected tag v0.1, got %s", release.TagName)
+	if release.TagName != exampleTagName {
+		t.Errorf("expected tag %s, got %s", exampleTagName, release.TagName)
 	}
-
 }
 
 func TestReleasesService_UpdateReleaseWithMilestones(t *testing.T) {
@@ -439,23 +290,22 @@ func TestReleasesService_UpdateReleaseWithMilestones(t *testing.T) {
 				t.Errorf("expected request body not to have released_at, got %s",
 					string(b))
 			}
-			fmt.Fprint(w, exampleReleaseRsp)
+			fmt.Fprint(w, exampleReleaseResponse)
 		})
 
 	opts := &UpdateReleaseOptions{
 		Name:        String("name"),
 		Description: String("Description"),
-		Milestones:  []string{"v0.1", "v0.1.0"},
+		Milestones:  []string{exampleTagName, "v0.1.0"},
 	}
 
-	release, _, err := client.Releases.UpdateRelease(1, "v0.1", opts)
+	release, _, err := client.Releases.UpdateRelease(1, exampleTagName, opts)
 	if err != nil {
 		t.Error(err)
 	}
-	if release.TagName != "v0.1" {
-		t.Errorf("expected tag v0.1, got %s", release.TagName)
+	if release.TagName != exampleTagName {
+		t.Errorf("expected tag %s, got %s", exampleTagName, release.TagName)
 	}
-
 }
 
 func TestReleasesService_UpdateReleaseWithReleasedAt(t *testing.T) {
@@ -477,7 +327,7 @@ func TestReleasesService_UpdateReleaseWithReleasedAt(t *testing.T) {
 				t.Errorf("expected request body to have released_at, got %s",
 					string(b))
 			}
-			fmt.Fprint(w, exampleReleaseRsp)
+			fmt.Fprint(w, exampleReleaseResponse)
 		})
 
 	opts := &UpdateReleaseOptions{
@@ -486,14 +336,13 @@ func TestReleasesService_UpdateReleaseWithReleasedAt(t *testing.T) {
 		ReleasedAt:  &time.Time{},
 	}
 
-	release, _, err := client.Releases.UpdateRelease(1, "v0.1", opts)
+	release, _, err := client.Releases.UpdateRelease(1, exampleTagName, opts)
 	if err != nil {
 		t.Error(err)
 	}
-	if release.TagName != "v0.1" {
-		t.Errorf("expected tag v0.1, got %s", release.TagName)
+	if release.TagName != exampleTagName {
+		t.Errorf("expected tag %s, got %s", exampleTagName, release.TagName)
 	}
-
 }
 
 func TestReleasesService_DeleteRelease(t *testing.T) {
@@ -503,15 +352,14 @@ func TestReleasesService_DeleteRelease(t *testing.T) {
 	mux.HandleFunc("/api/v4/projects/1/releases/v0.1",
 		func(w http.ResponseWriter, r *http.Request) {
 			testMethod(t, r, "DELETE")
-			fmt.Fprint(w, exampleReleaseRsp)
+			fmt.Fprint(w, exampleReleaseResponse)
 		})
 
-	release, _, err := client.Releases.DeleteRelease(1, "v0.1")
+	release, _, err := client.Releases.DeleteRelease(1, exampleTagName)
 	if err != nil {
 		t.Error(err)
 	}
-	if release.TagName != "v0.1" {
-		t.Errorf("expected tag v0.1, got %s", release.TagName)
+	if release.TagName != exampleTagName {
+		t.Errorf("expected tag %s, got %s", exampleTagName, release.TagName)
 	}
-
 }
diff --git a/runners_test.go b/runners_test.go
index b9ac0d2..e3f1d9a 100644
--- a/runners_test.go
+++ b/runners_test.go
@@ -77,46 +77,13 @@ func TestRemoveRunner(t *testing.T) {
 	}
 }
 
-const exampleDetailRsp = `{
-	"active": true,
-	"architecture": null,
-	"description": "test-1-20150125-test",
-	"run_untagged": true,
-	"id": 6,
-	"is_shared": false,
-	"contacted_at": "2016-01-25T16:39:48.066Z",
-	"name": null,
-	"online": true,
-	"status": "online",
-	"platform": null,
-	"projects": [
-		{
-			"id": 1,
-			"name": "GitLab Community Edition",
-			"name_with_namespace": "GitLab.org / GitLab Community Edition",
-			"path": "gitlab-ce",
-			"path_with_namespace": "gitlab-org/gitlab-ce"
-		}
-	],
-	"token": "205086a8e3b9a2b818ffac9b89d102",
-	"revision": null,
-	"tag_list": [
-		"ruby",
-		"mysql"
-	],
-	"version": null,
-	"access_level": "ref_protected",
-	"maximum_timeout": 3600,
-	"locked": false
-}`
-
 func TestUpdateRunnersDetails(t *testing.T) {
 	mux, server, client := setup(t)
 	defer teardown(server)
 
 	mux.HandleFunc("/api/v4/runners/6", func(w http.ResponseWriter, r *http.Request) {
 		testMethod(t, r, "PUT")
-		fmt.Fprint(w, exampleDetailRsp)
+		fmt.Fprint(w, exampleDetailResponse)
 	})
 
 	opt := &UpdateRunnerDetailsOptions{}
@@ -138,7 +105,7 @@ func TestGetRunnerDetails(t *testing.T) {
 
 	mux.HandleFunc("/api/v4/runners/6", func(w http.ResponseWriter, r *http.Request) {
 		testMethod(t, r, "GET")
-		fmt.Fprint(w, exampleDetailRsp)
+		fmt.Fprint(w, exampleDetailResponse)
 	})
 
 	details, _, err := client.Runners.GetRunnerDetails(6, nil)
@@ -194,11 +161,6 @@ func expectedParsedNewRunner() *Runner {
 	}
 }
 
-const exampleRegisterNewRunner = `{
-	"id": 12345,
-	"token": "6337ff461c94fd3fa32ba3b1ff4125"
-}`
-
 func TestRegisterNewRunner(t *testing.T) {
 	mux, server, client := setup(t)
 	defer teardown(server)
diff --git a/testdata/get_user_memberships.json b/testdata/get_user_memberships.json
index 198bba8..80dfd62 100644
--- a/testdata/get_user_memberships.json
+++ b/testdata/get_user_memberships.json
@@ -3,12 +3,12 @@
     "source_id": 1,
     "source_name": "Project one",
     "source_type": "Project",
-    "access_level": 20
+    "access_level": "20"
   },
   {
     "source_id": 3,
     "source_name": "Group three",
     "source_type": "Namespace",
-    "access_level": 20
+    "access_level": "20"
   }
 ]
diff --git a/users_test.go b/users_test.go
index 4445721..283eadf 100644
--- a/users_test.go
+++ b/users_test.go
@@ -253,6 +253,6 @@ func TestGetMemberships(t *testing.T) {
 	memberships, _, err := client.Users.GetUserMemberships(1, opt)
 	require.NoError(t, err)
 
-	want := []*UserMembership{{SourceID: 1, SourceName: "Project one", SourceType: "Project", AccessLevel: 20}, {SourceID: 3, SourceName: "Group three", SourceType: "Namespace", AccessLevel: 20}}
+	want := []*UserMembership{{SourceID: 1, SourceName: "Project one", SourceType: "Project", AccessLevel: "20"}, {SourceID: 3, SourceName: "Group three", SourceType: "Namespace", AccessLevel: "20"}}
 	assert.Equal(t, want, memberships)
 }