1
0
mirror of https://github.com/interviewstreet/go-jira.git synced 2025-07-15 01:04:38 +02:00

Merge remote-tracking branch 'origin/master' into develop

* origin/master:
  When creating issue links, the id and self should be omitted along with comment if none is provided
  Expose comment ID
  Make issue link direction visible
  using Time for WorklogRecord.Started
  Adjusted a few things to be in line with other methods
  go fmt
  go fmt, go doc and reuse of Project struct
  Renamed "json_mocks" into "mocks"
  Refactored struct types by reusing already existing components
  Fixed typo in Cookies
  Moved progect.go to project.go
  Fix #12: Expose the base JIRA URL
  update .gitignore
  using native time.Time
  updating with search and worklogs

# Conflicts:
#	project_test.go
This commit is contained in:
Evgen Kostenko
2016-06-15 12:25:10 +03:00
10 changed files with 337 additions and 139 deletions

View File

@ -10,15 +10,15 @@ import (
func TestProjectGetAll(t *testing.T) {
setup()
defer teardown()
testApiEdpoint := "/rest/api/2/project"
testAPIEdpoint := "/rest/api/2/project"
raw, err := ioutil.ReadFile("./json_mocks/all_projects.json")
raw, err := ioutil.ReadFile("./mocks/all_projects.json")
if err != nil {
t.Error(err.Error())
}
testMux.HandleFunc(testApiEdpoint, func(w http.ResponseWriter, r *http.Request) {
testMux.HandleFunc(testAPIEdpoint, func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
testRequestURL(t, r, testApiEdpoint)
testRequestURL(t, r, testAPIEdpoint)
fmt.Fprint(w, string(raw))
})
@ -34,15 +34,15 @@ func TestProjectGetAll(t *testing.T) {
func TestProjectGet(t *testing.T) {
setup()
defer teardown()
testApiEdpoint := "/rest/api/2/project/12310505"
testAPIEdpoint := "/rest/api/2/project/12310505"
raw, err := ioutil.ReadFile("./json_mocks/project.json")
raw, err := ioutil.ReadFile("./mocks/project.json")
if err != nil {
t.Error(err.Error())
}
testMux.HandleFunc(testApiEdpoint, func(w http.ResponseWriter, r *http.Request) {
testMux.HandleFunc(testAPIEdpoint, func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
testRequestURL(t, r, testApiEdpoint)
testRequestURL(t, r, testAPIEdpoint)
fmt.Fprint(w, string(raw))
})
@ -58,11 +58,11 @@ func TestProjectGet(t *testing.T) {
func TestProjectGet_NoProject(t *testing.T) {
setup()
defer teardown()
testApiEdpoint := "/rest/api/2/project/99999999"
testAPIEdpoint := "/rest/api/2/project/99999999"
testMux.HandleFunc(testApiEdpoint, func(w http.ResponseWriter, r *http.Request) {
testMux.HandleFunc(testAPIEdpoint, func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
testRequestURL(t, r, testApiEdpoint)
testRequestURL(t, r, testAPIEdpoint)
fmt.Fprint(w, nil)
})