|
1 |
| -describe("APIService", function(){ |
| 1 | +describe("APIService", function() { |
2 | 2 | var APIService;
|
3 | 3 |
|
4 | 4 | beforeEach(function(){
|
5 |
| - inject(function(_APIService_){ |
| 5 | + inject(function(_APIService_) { |
6 | 6 | APIService = _APIService_;
|
7 | 7 | });
|
8 | 8 | });
|
9 | 9 |
|
10 |
| - describe("#toResourceGroupVersion", function(){ |
| 10 | + describe("#toResourceGroupVersion", function() { |
11 | 11 |
|
12 | 12 | var tc = [
|
13 | 13 | // string args
|
@@ -62,7 +62,8 @@ describe("APIService", function(){
|
62 | 62 | }));
|
63 | 63 |
|
64 | 64 | });
|
65 |
| -/* |
| 65 | + |
| 66 | + |
66 | 67 | describe("#parseGroupVersion", function(){
|
67 | 68 | var tc = [
|
68 | 69 | // invalid cases
|
@@ -234,6 +235,50 @@ describe("APIService", function(){
|
234 | 235 | });
|
235 | 236 | }));
|
236 | 237 | });
|
237 |
| - */ |
| 238 | + |
| 239 | + |
| 240 | + describe('#availableKinds', function() { |
| 241 | + // at minimum, prove with tests that it is deduplicating by ignoring openshift! |
| 242 | + it('should return list of kinds that are scoped to a namespace by default', function() { |
| 243 | + var namespacedKinds = APIService.availableKinds(); |
| 244 | + var expectedNames = [ |
| 245 | + 'Binding', 'ConfigMap', 'Endpoints', 'Event', 'LimitRange', 'PersistentVolumeClaim', 'Pod', 'PodTemplate', |
| 246 | + 'ReplicationController', 'ResourceQuota', 'Secret', 'ServiceAccount', 'Service', 'StatefulSet', 'DeploymentConfig', |
| 247 | + 'LocalSubjectAccessReview', 'LocalResourceAccessReview', 'LocalSubjectAccessReview', 'Policy', 'PolicyBinding', |
| 248 | + 'ResourceAccessReview', 'RoleBindingRestriction', 'RoleBinding', 'Role', 'SelfSubjectRulesReview', |
| 249 | + 'SubjectAccessReview', 'SubjectRulesReview', 'BuildConfig', 'Build', 'DaemonSet', 'Deployment', |
| 250 | + 'HorizontalPodAutoscaler', 'Ingress', 'Job', 'NetworkPolicy', 'ReplicaSet', 'ReplicationControllerDummy', |
| 251 | + 'ImageStreamImage', 'ImageStreamImport', 'ImageStreamMapping', 'ImageStream', 'ImageStreamTag', 'EgressNetworkPolicy', |
| 252 | + 'PodDisruptionBudget', 'AppliedClusterResourceQuota', 'Route', 'PodSecurityPolicyReview', |
| 253 | + 'PodSecurityPolicySelfSubjectReview', 'PodSecurityPolicySubjectReview', 'Template', 'TemplateInstance' |
| 254 | + ]; |
| 255 | + // from the fixtures included, we should have 51 namespaced kinds |
| 256 | + expect(namespacedKinds.length).toEqual(51); |
| 257 | + expect( _.map(namespacedKinds, 'kind') ).toEqual(expectedNames); |
| 258 | + }); |
| 259 | + |
| 260 | + it('should return list of all kinds, including those that are cluster scoped, when passed a truthy argument', function() { |
| 261 | + var allKinds = APIService.availableKinds(true); |
| 262 | + var expectedNames = [ |
| 263 | + 'Binding', 'ComponentStatus', 'ConfigMap', 'Endpoints', 'Event', 'LimitRange', 'Namespace', 'Node', |
| 264 | + 'PersistentVolumeClaim', 'PersistentVolume', 'Pod', 'PodTemplate', 'ReplicationController', 'ResourceQuota', 'Secret', |
| 265 | + 'SecurityContextConstraints', 'ServiceAccount', 'Service', 'StatefulSet', 'DeploymentConfig', 'TokenReview', |
| 266 | + 'LocalSubjectAccessReview', 'SelfSubjectAccessReview', 'SubjectAccessReview', 'ClusterPolicy', 'ClusterPolicyBinding', |
| 267 | + 'ClusterRoleBinding', 'ClusterRole', 'LocalResourceAccessReview', 'LocalSubjectAccessReview', 'Policy', 'PolicyBinding', |
| 268 | + 'ResourceAccessReview', 'RoleBindingRestriction', 'RoleBinding', 'Role', 'SelfSubjectRulesReview', 'SubjectAccessReview', |
| 269 | + 'SubjectRulesReview', 'BuildConfig', 'Build', 'CertificateSigningRequest', 'DaemonSet', 'Deployment', |
| 270 | + 'HorizontalPodAutoscaler', 'Ingress', 'Job', 'NetworkPolicy', 'PodSecurityPolicy', 'ReplicaSet', |
| 271 | + 'ReplicationControllerDummy', 'ThirdPartyResource', 'Image', 'ImageSignature', 'ImageStreamImage', 'ImageStreamImport', |
| 272 | + 'ImageStreamMapping', 'ImageStream', 'ImageStreamTag', 'ClusterNetwork', 'EgressNetworkPolicy', 'HostSubnet', |
| 273 | + 'NetNamespace', 'OAuthAccessToken', 'OAuthAuthorizeToken', 'OAuthClientAuthorization', 'OAuthClient', |
| 274 | + 'PodDisruptionBudget', 'ProjectRequest', 'Project', 'AppliedClusterResourceQuota', 'ClusterResourceQuota', 'Route', |
| 275 | + 'PodSecurityPolicyReview', 'PodSecurityPolicySelfSubjectReview', 'PodSecurityPolicySubjectReview', 'StorageClass', |
| 276 | + 'BrokerTemplateInstance', 'Template', 'TemplateInstance', 'Group', 'Identity', 'UserIdentityMapping', 'User' |
| 277 | + ]; |
| 278 | + // from the fixtures included, we should have 84 total kinds |
| 279 | + expect(allKinds.length).toEqual(84); |
| 280 | + expect( _.map(allKinds, 'kind') ).toEqual(expectedNames); |
| 281 | + }); |
| 282 | + }); |
238 | 283 |
|
239 | 284 | });
|
0 commit comments