mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-23 02:35:17 +01:00
Merge pull request #2511 from ywk253100/170614_test
Update test case for project manager based on admiral
This commit is contained in:
commit
34f43e0542
@ -183,7 +183,11 @@ func TestGet(t *testing.T) {
|
||||
Name: name,
|
||||
})
|
||||
require.Nil(t, err)
|
||||
defer pm.Delete(id)
|
||||
defer func(id int64) {
|
||||
if err := pm.Delete(id); err != nil {
|
||||
require.Nil(t, err)
|
||||
}
|
||||
}(id)
|
||||
|
||||
// get by invalid input type
|
||||
_, err = pm.Get([]string{})
|
||||
@ -230,7 +234,11 @@ func TestIsPublic(t *testing.T) {
|
||||
Public: 1,
|
||||
})
|
||||
require.Nil(t, err)
|
||||
defer pm.Delete(id)
|
||||
defer func(id int64) {
|
||||
if err := pm.Delete(id); err != nil {
|
||||
require.Nil(t, err)
|
||||
}
|
||||
}(id)
|
||||
|
||||
public, err = pm.IsPublic(id)
|
||||
assert.Nil(t, err)
|
||||
@ -247,7 +255,11 @@ func TestIsPublic(t *testing.T) {
|
||||
Public: 0,
|
||||
})
|
||||
require.Nil(t, err)
|
||||
defer pm.Delete(id)
|
||||
defer func(id int64) {
|
||||
if err := pm.Delete(id); err != nil {
|
||||
require.Nil(t, err)
|
||||
}
|
||||
}(id)
|
||||
|
||||
public, err = pm.IsPublic(id)
|
||||
assert.Nil(t, err)
|
||||
@ -277,7 +289,11 @@ func TestExist(t *testing.T) {
|
||||
Name: name,
|
||||
})
|
||||
require.Nil(t, err)
|
||||
defer pm.Delete(id)
|
||||
defer func(id int64) {
|
||||
if err := pm.Delete(id); err != nil {
|
||||
require.Nil(t, err)
|
||||
}
|
||||
}(id)
|
||||
|
||||
exist, err = pm.Exist(id)
|
||||
assert.Nil(t, err)
|
||||
@ -306,7 +322,11 @@ func TestGetRoles(t *testing.T) {
|
||||
Name: name,
|
||||
})
|
||||
require.Nil(t, err)
|
||||
defer pm.Delete(id)
|
||||
defer func(id int64) {
|
||||
if err := pm.Delete(id); err != nil {
|
||||
require.Nil(t, err)
|
||||
}
|
||||
}(id)
|
||||
|
||||
roles, err = pm.GetRoles("user01", id)
|
||||
assert.Nil(t, err)
|
||||
@ -328,7 +348,11 @@ func TestGetPublic(t *testing.T) {
|
||||
Public: 1,
|
||||
})
|
||||
require.Nil(t, err)
|
||||
defer pm.Delete(id)
|
||||
defer func(id int64) {
|
||||
if err := pm.Delete(id); err != nil {
|
||||
require.Nil(t, err)
|
||||
}
|
||||
}(id)
|
||||
|
||||
projects, err = pm.GetPublic()
|
||||
assert.Nil(t, nil)
|
||||
@ -362,7 +386,11 @@ func TestCreate(t *testing.T) {
|
||||
AutomaticallyScanImagesOnPush: true,
|
||||
})
|
||||
require.Nil(t, err)
|
||||
defer pm.Delete(id)
|
||||
defer func(id int64) {
|
||||
if err := pm.Delete(id); err != nil {
|
||||
require.Nil(t, err)
|
||||
}
|
||||
}(id)
|
||||
|
||||
project, err := pm.Get(id)
|
||||
assert.Nil(t, err)
|
||||
|
Loading…
Reference in New Issue
Block a user