Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
wj00037 committed Nov 8, 2024
1 parent 66d9b9a commit b4ed6b9
Showing 1 changed file with 8 additions and 16 deletions.
24 changes: 8 additions & 16 deletions auth/gitee_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package auth

import (
"os"
"testing"

"github.com/stretchr/testify/assert"
Expand All @@ -11,23 +10,18 @@ import (
// SuiteUserInRepo used for testing
type SuiteUserInRepo struct {
suite.Suite
Repo string
Owner string
Token string
Username string
Password string
Operation string
// userInRepo UserInRepo
Repo string
Owner string
}

// SetupSuite used for testing
func (s *SuiteUserInRepo) SetupSuite() {
username := os.Getenv("GITEE_USER")
token := os.Getenv("GITEE_TOKEN")
// username := os.Getenv("GITEE_USER")
// token := os.Getenv("GITEE_TOKEN")
s.Repo = "software-package-server"
s.Owner = "src-openeuler"
s.Username = username
s.Token = token
// s.Username = username
// s.Token = token
}

// TearDownSuite used for testing
Expand All @@ -37,7 +31,7 @@ func (s *SuiteUserInRepo) TearDownSuite() {

func (s *SuiteUserInRepo) TestGetToken() {
// getToken fail
token, err := getToken(s.Username, "wrong_pwd")
token, err := getToken("user", "wrong_pwd")
assert.Equal(s.T(), "", token)
assert.NotNil(s.T(), err.Error())
}
Expand All @@ -64,13 +58,11 @@ func (s *SuiteUserInRepo) TestVerifyUser() {
userInRepo := UserInRepo{
Repo: s.Repo,
Owner: s.Owner,
Token: s.Token,
Username: s.Username,
Operation: "download",
}

err := verifyUser(userInRepo)
assert.Nil(s.T(), err)
assert.NotNil(s.T(), err)
}

func TestGitee(t *testing.T) {
Expand Down

0 comments on commit b4ed6b9

Please sign in to comment.