1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
package common
import (
"fmt"
"testing"
. "gopkg.in/check.v1"
)
func Test(t *testing.T) { TestingT(t) }
type CommonSuite struct{}
var _ = Suite(&CommonSuite{})
func (s *CommonSuite) TestIsRepoNotFoundErrorForUnknownSource(c *C) {
msg := "unknown system is complaining of something very sad :("
isRepoNotFound := isRepoNotFoundError(msg)
c.Assert(isRepoNotFound, Equals, false)
}
func (s *CommonSuite) TestIsRepoNotFoundErrorForGithub(c *C) {
msg := fmt.Sprintf("%s : some error stuf", githubRepoNotFoundErr)
isRepoNotFound := isRepoNotFoundError(msg)
c.Assert(isRepoNotFound, Equals, true)
}
func (s *CommonSuite) TestIsRepoNotFoundErrorForBitBucket(c *C) {
msg := fmt.Sprintf("%s : some error stuf", bitbucketRepoNotFoundErr)
isRepoNotFound := isRepoNotFoundError(msg)
c.Assert(isRepoNotFound, Equals, true)
}
func (s *CommonSuite) TestIsRepoNotFoundErrorForLocal(c *C) {
msg := fmt.Sprintf("some error stuf : %s", localRepoNotFoundErr)
isRepoNotFound := isRepoNotFoundError(msg)
c.Assert(isRepoNotFound, Equals, true)
}
func (s *CommonSuite) TestIsRepoNotFoundErrorForGitProtocolNotFound(c *C) {
msg := fmt.Sprintf("%s : some error stuf", gitProtocolNotFoundErr)
isRepoNotFound := isRepoNotFoundError(msg)
c.Assert(isRepoNotFound, Equals, true)
}
func (s *CommonSuite) TestIsRepoNotFoundErrorForGitProtocolNoSuch(c *C) {
msg := fmt.Sprintf("%s : some error stuf", gitProtocolNoSuchErr)
isRepoNotFound := isRepoNotFoundError(msg)
c.Assert(isRepoNotFound, Equals, true)
}
func (s *CommonSuite) TestIsRepoNotFoundErrorForGitProtocolAccessDenied(c *C) {
msg := fmt.Sprintf("%s : some error stuf", gitProtocolAccessDeniedErr)
isRepoNotFound := isRepoNotFoundError(msg)
c.Assert(isRepoNotFound, Equals, true)
}
func (s *CommonSuite) TestIsRepoNotFoundErrorForGogsAccessDenied(c *C) {
msg := fmt.Sprintf("%s : some error stuf", gogsAccessDeniedErr)
isRepoNotFound := isRepoNotFoundError(msg)
c.Assert(isRepoNotFound, Equals, true)
}
func (s *CommonSuite) TestCheckNotFoundError(c *C) {
firstErrLine := make(chan string, 1)
session := session{
firstErrLine: firstErrLine,
}
firstErrLine <- ""
err := session.checkNotFoundError()
c.Assert(err, IsNil)
}
|