forked from openshift/origin-web-console
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreateFromImageSpec.js
122 lines (108 loc) · 3.68 KB
/
createFromImageSpec.js
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
"use strict";
describe("CreateFromImageController", function(){
var controller;
var $scope = {
name: "apPname",
projectName: "aProjectName"
};
var $routeParams = {
imageName: "anImageName",
imageTag: "latest",
namespace: "aNamespace"
};
beforeEach(function(){
inject(function(_$controller_, $q){
// The injector unwraps the underscores (_) from around the parameter names when matching
controller = _$controller_("CreateFromImageController", {
$scope: $scope,
$routeParams: $routeParams,
DataService: {
get: function(kind){
var deferred = $q.defer();
deferred.resolve({});
return deferred.promise;
}
},
Navigate: {
toErrorPage: function(message){}
},
ProjectsService: {
get: function(name) {
return $q.when([
{
metadata: {
'name': 'foo',
'selfLink': '/oapi/v1/projects/foo',
'uid': 'c6fdde8d-979b-11e5-8493-080027c5bfa9',
'resourceVersion': '25334',
'creationTimestamp': '2015-11-30T19:51:41Z',
'annotations': {
'openshift.io/description': 'Foo',
'openshift.io/display-name': 'foo'
}
},
spec: {
'finalizers': [
'openshift.io/origin',
'kubernetes'
]
},
status: {
'phase': 'Active'
}
}, {
projectPromise: $q.when({}),
projectName: 'foo',
project: undefined
}
]);
}
}
});
});
});
it("valid http URL", function(){
var match = 'http://example.com/dir1/dir2'.match($scope.sourceURLPattern);
expect(match).not.toBeNull();
});
it("invalid http URL, without http part", function(){
var match = 'example.com/dir1/dir2'.match($scope.sourceURLPattern);
expect(match).toBeNull();
});
it("valid http URL with user and password", function(){
var match = 'http://user:[email protected]/dir1/dir2'.match($scope.sourceURLPattern);
expect(match).not.toBeNull();
});
it("valid http URL with user and password with special characters", function(){
var match = 'https://user:[email protected]/gerrit/p/myrepo.git'.match($scope.sourceURLPattern);
expect(match).not.toBeNull();
});
it("valid http URL with port", function(){
var match = 'http://example.com:8080/dir1/dir2'.match($scope.sourceURLPattern);
expect(match).not.toBeNull();
});
it("valid http URL with port, user and password", function(){
var match = 'http://user:[email protected]:8080/dir1/dir2'.match($scope.sourceURLPattern);
expect(match).not.toBeNull();
});
it("valid https URL", function(){
var match = 'https://example.com/dir1/dir2'.match($scope.sourceURLPattern);
expect(match).not.toBeNull();
});
it("valid ftp URL", function(){
var match = 'ftp://example.com/dir1/dir2'.match($scope.sourceURLPattern);
expect(match).not.toBeNull();
});
it("valid git+ssh URL", function(){
var match = '[email protected]:dir1/dir2'.match($scope.sourceURLPattern);
expect(match).not.toBeNull();
});
it("valid ssh URL", function(){
var match = 'ssh://[email protected]/dir1/dir2'.match($scope.sourceURLPattern);
expect(match).not.toBeNull();
});
it("valid ssh URL with custom port", function(){
var match = 'ssh://[email protected]:8080/dir1/dir2'.match($scope.sourceURLPattern);
expect(match).not.toBeNull();
});
});