@@ -21,20 +21,6 @@ func generateDummyGitStarterProject(name string, checkoutRemote *v1alpha2.Checko
21
21
}
22
22
}
23
23
24
- func generateDummyGithubStarterProject (name string , checkoutRemote * v1alpha2.CheckoutFrom , remotes map [string ]string ) v1alpha2.StarterProject {
25
- return v1alpha2.StarterProject {
26
- Name : name ,
27
- ProjectSource : v1alpha2.ProjectSource {
28
- Github : & v1alpha2.GithubProjectSource {
29
- GitLikeProjectSource : v1alpha2.GitLikeProjectSource {
30
- Remotes : remotes ,
31
- CheckoutFrom : checkoutRemote ,
32
- },
33
- },
34
- },
35
- }
36
- }
37
-
38
24
func generateDummyGitProject (name string , checkoutRemote * v1alpha2.CheckoutFrom , remotes map [string ]string ) v1alpha2.Project {
39
25
return v1alpha2.Project {
40
26
Name : name ,
@@ -49,20 +35,6 @@ func generateDummyGitProject(name string, checkoutRemote *v1alpha2.CheckoutFrom,
49
35
}
50
36
}
51
37
52
- func generateDummyGithubProject (name string , checkoutRemote * v1alpha2.CheckoutFrom , remotes map [string ]string ) v1alpha2.Project {
53
- return v1alpha2.Project {
54
- Name : name ,
55
- ProjectSource : v1alpha2.ProjectSource {
56
- Github : & v1alpha2.GithubProjectSource {
57
- GitLikeProjectSource : v1alpha2.GitLikeProjectSource {
58
- Remotes : remotes ,
59
- CheckoutFrom : checkoutRemote ,
60
- },
61
- },
62
- },
63
- }
64
- }
65
-
66
38
func TestValidateStarterProjects (t * testing.T ) {
67
39
68
40
oneRemoteErr := "starterProject .* should have one remote only"
@@ -84,14 +56,14 @@ func TestValidateStarterProjects(t *testing.T) {
84
56
{
85
57
name : "Invalid Starter Project" ,
86
58
starterProjects : []v1alpha2.StarterProject {
87
- generateDummyGithubStarterProject ("project1" , & v1alpha2.CheckoutFrom {Remote : "origin" }, map [string ]string {"origin" : "originremote" , "test" : "testremote" }),
59
+ generateDummyGitStarterProject ("project1" , & v1alpha2.CheckoutFrom {Remote : "origin" }, map [string ]string {"origin" : "originremote" , "test" : "testremote" }),
88
60
},
89
61
wantErr : & oneRemoteErr ,
90
62
},
91
63
{
92
64
name : "Invalid Starter Project with wrong checkout" ,
93
65
starterProjects : []v1alpha2.StarterProject {
94
- generateDummyGithubStarterProject ("project1" , & v1alpha2.CheckoutFrom {Remote : "origin" }, map [string ]string {"test" : "testremote" }),
66
+ generateDummyGitStarterProject ("project1" , & v1alpha2.CheckoutFrom {Remote : "origin" }, map [string ]string {"test" : "testremote" }),
95
67
},
96
68
wantErr : & wrongCheckoutErr ,
97
69
},
@@ -110,8 +82,8 @@ func TestValidateStarterProjects(t *testing.T) {
110
82
{
111
83
name : "Invalid Starter Project with empty remotes" ,
112
84
starterProjects : []v1alpha2.StarterProject {
113
- generateDummyGithubStarterProject ("project1" , & v1alpha2.CheckoutFrom {Remote : "origin" }, map [string ]string {}),
114
- generateDummyGithubStarterProject ("project3" , & v1alpha2.CheckoutFrom {Remote : "origin" }, map [string ]string {"origin" : "originremote" , "test" : "testremote" }),
85
+ generateDummyGitStarterProject ("project1" , & v1alpha2.CheckoutFrom {Remote : "origin" }, map [string ]string {}),
86
+ generateDummyGitStarterProject ("project3" , & v1alpha2.CheckoutFrom {Remote : "origin" }, map [string ]string {"origin" : "originremote" , "test" : "testremote" }),
115
87
},
116
88
wantErr : & atleastOneRemoteErr ,
117
89
},
@@ -144,28 +116,28 @@ func TestValidateProjects(t *testing.T) {
144
116
name : "Valid Project" ,
145
117
projects : []v1alpha2.Project {
146
118
generateDummyGitProject ("project1" , & v1alpha2.CheckoutFrom {Remote : "origin" }, map [string ]string {"origin" : "originremote" }),
147
- generateDummyGithubProject ("project2" , & v1alpha2.CheckoutFrom {Remote : "origin" }, map [string ]string {"origin" : "originremote" }),
119
+ generateDummyGitProject ("project2" , & v1alpha2.CheckoutFrom {Remote : "origin" }, map [string ]string {"origin" : "originremote" }),
148
120
},
149
121
},
150
122
{
151
123
name : "Invalid Project with multiple remotes but no checkoutfrom" ,
152
124
projects : []v1alpha2.Project {
153
- generateDummyGithubProject ("project2" , nil , map [string ]string {"origin" : "originremote" , "test" : "testremote" }),
125
+ generateDummyGitProject ("project2" , nil , map [string ]string {"origin" : "originremote" , "test" : "testremote" }),
154
126
},
155
127
wantErr : & missingCheckOutFromRemoteErr ,
156
128
},
157
129
{
158
130
name : "Invalid Project with multiple remote and empty checkout remote" ,
159
131
projects : []v1alpha2.Project {
160
132
generateDummyGitProject ("project2" , & v1alpha2.CheckoutFrom {Remote : "origin" }, map [string ]string {"origin" : "originremote" }),
161
- generateDummyGithubProject ("project1" , & v1alpha2.CheckoutFrom {Remote : "" }, map [string ]string {"origin" : "originremote" , "test" : "testremote" }),
133
+ generateDummyGitProject ("project1" , & v1alpha2.CheckoutFrom {Remote : "" }, map [string ]string {"origin" : "originremote" , "test" : "testremote" }),
162
134
},
163
135
wantErr : & missingCheckOutFromRemoteErr ,
164
136
},
165
137
{
166
138
name : "Invalid Project with wrong checkout" ,
167
139
projects : []v1alpha2.Project {
168
- generateDummyGithubProject ("project1" , & v1alpha2.CheckoutFrom {Remote : "origin1" }, map [string ]string {"origin" : "originremote" , "test" : "testremote" }),
140
+ generateDummyGitProject ("project1" , & v1alpha2.CheckoutFrom {Remote : "origin1" }, map [string ]string {"origin" : "originremote" , "test" : "testremote" }),
169
141
generateDummyGitProject ("project2" , & v1alpha2.CheckoutFrom {Remote : "origin1" }, map [string ]string {"origin2" : "originremote2" }),
170
142
},
171
143
wantErr : & wrongCheckoutErr ,
@@ -180,7 +152,7 @@ func TestValidateProjects(t *testing.T) {
180
152
name : "Invalid Project with empty remotes" ,
181
153
projects : []v1alpha2.Project {
182
154
generateDummyGitProject ("project1" , & v1alpha2.CheckoutFrom {Remote : "origin" }, map [string ]string {}),
183
- generateDummyGithubProject ("project2" , & v1alpha2.CheckoutFrom {Remote : "origins" }, map [string ]string {"origin" : "originremote" , "test" : "testremote" }),
155
+ generateDummyGitProject ("project2" , & v1alpha2.CheckoutFrom {Remote : "origins" }, map [string ]string {"origin" : "originremote" , "test" : "testremote" }),
184
156
},
185
157
wantErr : & atleastOneRemoteErr ,
186
158
},
0 commit comments