Commit b95ccd06 authored by Martin Sefcik's avatar Martin Sefcik

Removed testify and used standard Go testing approach

parent 7608e90b
package gitlab package gitlab
import ( import (
"github.com/stretchr/testify/assert"
"testing" "testing"
) )
func TestListAllProjects(t *testing.T) { func TestListAllProjects(t *testing.T) {
ts, client := Stub("stubs/projects/index.json") ts, client := Stub("stubs/projects/index.json")
defer ts.Close()
opt := &ListProjectsOptions{} opt := &ListProjectsOptions{}
projects, _, err := client.Projects.ListAllProjects(opt) projects, _, err := client.Projects.ListAllProjects(opt)
assert.Equal(t, err, nil) if err != nil {
assert.Equal(t, len(projects), 2) t.Fatal(err)
assert.Equal(t, projects[0].Name, "project") }
assert.Equal(t, projects[1].Name, "project2")
defer ts.Close() 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) { func TestGetProject(t *testing.T) {
ts, client := Stub("stubs/projects/show.json") ts, client := Stub("stubs/projects/show.json")
defer ts.Close()
project, _, err := client.Projects.GetProject(1) project, _, err := client.Projects.GetProject(1)
assert.Equal(t, err, nil) if err != nil {
assert.Equal(t, project.Name, "project") t.Fatal(err)
assert.Equal(t, project.Namespace.Name, "group") }
assert.Equal(t, project.Permissions.ProjectAccess.AccessLevel, MasterPermissions)
assert.Nil(t, project.Permissions.GroupAccess) if project.Name != "project" {
defer ts.Close() t.Fail()
}
if project.Namespace.Name != "group" {
t.Fail()
}
if project.Permissions.ProjectAccess.AccessLevel != MasterPermissions {
t.Fail()
}
if project.Permissions.GroupAccess != nil {
t.Fail()
}
} }
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