Skip to content

Commit

Permalink
refactor(tempo): rename worklog search and create path
Browse files Browse the repository at this point in the history
  • Loading branch information
gabor-boros committed Oct 8, 2021
1 parent 202ac41 commit b3d1ede
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions internal/pkg/client/tempo/tempo.go
Expand Up @@ -14,10 +14,10 @@ import (
)

const (
// WorklogCreatePath is the endpoint used to create new worklogs.
WorklogCreatePath string = "/rest/tempo-timesheets/4/worklogs"
// WorklogSearchPath is the endpoint used to search existing worklogs.
WorklogSearchPath string = "/rest/tempo-timesheets/4/worklogs/search"
// PathWorklogCreate is the endpoint used to create new worklogs.
PathWorklogCreate string = "/rest/tempo-timesheets/4/worklogs"
// PathWorklogSearch is the endpoint used to search existing worklogs.
PathWorklogSearch string = "/rest/tempo-timesheets/4/worklogs/search"
)

// Issue represents the Jira issue the time logged against.
Expand Down Expand Up @@ -78,7 +78,7 @@ func (c *tempoClient) FetchEntries(ctx context.Context, opts *client.FetchOpts)
Worker: opts.User,
}

resp, err := client.SendRequest(ctx, http.MethodPost, WorklogSearchPath, searchParams, &c.opts.HTTPClientOptions)
resp, err := client.SendRequest(ctx, http.MethodPost, PathWorklogSearch, searchParams, &c.opts.HTTPClientOptions)
if err != nil {
return nil, fmt.Errorf("%v: %v", client.ErrFetchEntries, err)
}
Expand Down Expand Up @@ -140,7 +140,7 @@ func (c *tempoClient) uploadEntry(ctx context.Context, item worklog.Entry, opts
Worker: opts.User,
}

if _, err := client.SendRequest(ctx, http.MethodPost, WorklogCreatePath, entry, &c.opts.HTTPClientOptions); err != nil {
if _, err := client.SendRequest(ctx, http.MethodPost, PathWorklogCreate, entry, &c.opts.HTTPClientOptions); err != nil {
errChan <- err
return
}
Expand Down
8 changes: 4 additions & 4 deletions internal/pkg/client/tempo/tempo_test.go
Expand Up @@ -177,7 +177,7 @@ func TestTempoClient_FetchEntries(t *testing.T) {
}

mockServer := newMockServer(t, &mockServerOpts{
Path: tempo.WorklogSearchPath,
Path: tempo.PathWorklogSearch,
Method: http.MethodPost,
StatusCode: http.StatusOK,
Username: clientUsername,
Expand Down Expand Up @@ -328,7 +328,7 @@ func TestTempoClient_UploadEntries(t *testing.T) {
}

mockServer := newMockServer(t, &mockServerOpts{
Path: tempo.WorklogCreatePath,
Path: tempo.PathWorklogCreate,
Method: http.MethodPost,
StatusCode: http.StatusOK,
Username: clientUsername,
Expand Down Expand Up @@ -421,7 +421,7 @@ func TestTempoClient_UploadEntries_TreatDurationAsBilled(t *testing.T) {
}

mockServer := newMockServer(t, &mockServerOpts{
Path: tempo.WorklogCreatePath,
Path: tempo.PathWorklogCreate,
Method: http.MethodPost,
StatusCode: http.StatusOK,
Username: clientUsername,
Expand Down Expand Up @@ -578,7 +578,7 @@ func TestTempoClient_UploadEntries_RoundToClosestMinute(t *testing.T) {
}

mockServer := newMockServer(t, &mockServerOpts{
Path: tempo.WorklogCreatePath,
Path: tempo.PathWorklogCreate,
Method: http.MethodPost,
StatusCode: http.StatusOK,
Username: clientUsername,
Expand Down

0 comments on commit b3d1ede

Please sign in to comment.