Skip to content

Commit 5a041cc

Browse files
committed
update test
1 parent 5feb0dd commit 5a041cc

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

services/repository/adopt_test.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,12 @@ func TestListUnadoptedRepositories_ListOptions(t *testing.T) {
9191
func TestAdoptRepository(t *testing.T) {
9292
assert.NoError(t, unittest.PrepareTestDatabase())
9393

94-
// a successful adopt
95-
destDir := filepath.Join(setting.RepoRootPath, "user2", "test-adopt.git")
96-
assert.NoError(t, unittest.SyncDirs(filepath.Join(setting.RepoRootPath, "user2", "repo1.git"), destDir))
9794
user2 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2})
95+
96+
// a successful adopt
97+
destDir := filepath.Join(setting.RepoRootPath, user2.Name, "test-adopt.git")
98+
assert.NoError(t, unittest.SyncDirs(filepath.Join(setting.RepoRootPath, user2.Name, "repo1.git"), destDir))
99+
98100
adoptedRepo, err := AdoptRepository(db.DefaultContext, user2, user2, CreateRepoOptions{Name: "test-adopt"})
99101
assert.NoError(t, err)
100102
repoTestAdopt := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{Name: "test-adopt"})
@@ -104,7 +106,7 @@ func TestAdoptRepository(t *testing.T) {
104106
err = deleteFailedAdoptRepository(adoptedRepo.ID)
105107
assert.NoError(t, err)
106108

107-
unittest.AssertNotExistsBean(t, &repo_model.Repository{OwnerName: "user2", Name: "test-adopt"})
109+
unittest.AssertNotExistsBean(t, &repo_model.Repository{OwnerName: user2.Name, Name: "test-adopt"})
108110

109111
// a failed adopt because some mock data
110112
// remove the hooks directory and create a file so that we cannot create the hooks successfully

0 commit comments

Comments
 (0)