Commit b95ccd06 authored by Martin Sefcik's avatar Martin Sefcik

Removed testify and used standard Go testing approach

parent 7608e90b
package gitlab
import (
"github.com/stretchr/testify/assert"
"testing"
)
func TestListAllProjects(t *testing.T) {
ts, client := Stub("stubs/projects/index.json")
defer ts.Close()
opt := &ListProjectsOptions{}
projects, _, err := client.Projects.ListAllProjects(opt)
assert.Equal(t, err, nil)
assert.Equal(t, len(projects), 2)
assert.Equal(t, projects[0].Name, "project")
assert.Equal(t, projects[1].Name, "project2")
defer ts.Close()
if err != nil {
t.Fatal(err)
}
if len(projects) != 2 {
t.Fail()
}
if projects[0].Name != "project" {
t.Fail()
}
if projects[1].Name != "project2" {
t.Fail()
}
}
func TestGetProject(t *testing.T) {
ts, client := Stub("stubs/projects/show.json")
defer ts.Close()
project, _, err := client.Projects.GetProject(1)
assert.Equal(t, err, nil)
assert.Equal(t, project.Name, "project")
assert.Equal(t, project.Namespace.Name, "group")
assert.Equal(t, project.Permissions.ProjectAccess.AccessLevel, MasterPermissions)
assert.Nil(t, project.Permissions.GroupAccess)
defer ts.Close()
}
\ No newline at end of file
if err != nil {
t.Fatal(err)
}
if project.Name != "project" {
t.Fail()
}
if project.Namespace.Name != "group" {
t.Fail()
}
if project.Permissions.ProjectAccess.AccessLevel != MasterPermissions {
t.Fail()
}
if project.Permissions.GroupAccess != nil {
t.Fail()
}
}
......@@ -81,4 +81,4 @@
"star_count": 0,
"forks_count": 0
}
]
\ No newline at end of file
]
......@@ -48,4 +48,4 @@
},
"group_access": null
}
}
\ No newline at end of file
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment