@@ -58,6 +58,13 @@ var _ = Describe("Gitea Provider", func() {
5858 Expect (* info .DefaultBranch ).To (Equal (defaultBranch ))
5959 }
6060
61+ It ("should get the current user" , func () {
62+ user , err := c .UserRepositories ().GetUserLogin (ctx )
63+ Expect (err ).ToNot (HaveOccurred ())
64+
65+ Expect (user .GetIdentity ()).To (Equal (giteaUser ))
66+ })
67+
6168 It ("should be possible to create a user repository" , func () {
6269 // First, check what repositories are available
6370 repos , err := c .UserRepositories ().List (ctx , newUserRef (giteaUser ))
@@ -100,17 +107,15 @@ var _ = Describe("Gitea Provider", func() {
100107 Expect (getSpec .Equals (postSpec )).To (BeTrue ())
101108 })
102109
103- It ("should return correct repo info when creating a repository with wrong UserLogin" , func () {
110+ It ("should fail when creating a repository with wrong UserLogin" , func () {
104111 repoName := fmt .Sprintf ("test-user-repo-creation-%03d" , rand .Intn (1000 ))
105112 repoRef := newUserRepoRef (repoName )
106113 repoRef .UserLogin = "yadda-yadda-yada"
107114
108- repo , err := c .UserRepositories ().Create (ctx , repoRef , gitprovider.RepositoryInfo {})
115+ _ , err := c .UserRepositories ().Create (ctx , repoRef , gitprovider.RepositoryInfo {})
109116
110- Expect (err ).To (BeNil ())
111- Expect (
112- repo .Repository ().GetCloneURL (gitprovider .TransportTypeHTTPS )).
113- To (Equal (fmt .Sprintf ("%s/%s/%s.git" , giteaBaseUrl , giteaUser , repoName )))
117+ expectedErr := gitprovider .NewErrIncorrectUser (repoRef .UserLogin )
118+ Expect (err ).To (MatchError (expectedErr ))
114119 })
115120
116121 It ("should error at creation time if the repo already does exist" , func () {
0 commit comments