How to use services method in ng-mocks

Best JavaScript code snippet using ng-mocks

codecov_vx.x.x.js

Source:codecov_vx.x.x.js Github

copy

Full Screen

1// flow-typed signature: 6e24585c5975777a957127364aee95592// flow-typed version: <<STUB>>/codecov_v^3.6.5/flow_v0.123.03/**4 * This is an autogenerated libdef stub for:5 *6 * 'codecov'7 *8 * Fill this stub out by replacing all the `any` types.9 *10 * Once filled out, we encourage you to share your work with the11 * community by sending a pull request to:12 * https://github.com/flowtype/flow-typed13 */14declare module 'codecov' {15 declare module.exports: any;16}17/**18 * We include stubs for each file inside this npm package in case you need to19 * require those files directly. Feel free to delete any files that aren't20 * needed.21 */22declare module 'codecov/lib/codecov' {23 declare module.exports: any;24}25declare module 'codecov/lib/detect' {26 declare module.exports: any;27}28declare module 'codecov/lib/git' {29 declare module.exports: any;30}31declare module 'codecov/lib/offline' {32 declare module.exports: any;33}34declare module 'codecov/lib/services/appveyor' {35 declare module.exports: any;36}37declare module 'codecov/lib/services/azurePipelines' {38 declare module.exports: any;39}40declare module 'codecov/lib/services/buildkite' {41 declare module.exports: any;42}43declare module 'codecov/lib/services/circle' {44 declare module.exports: any;45}46declare module 'codecov/lib/services/cirrus' {47 declare module.exports: any;48}49declare module 'codecov/lib/services/codebuild' {50 declare module.exports: any;51}52declare module 'codecov/lib/services/codeship' {53 declare module.exports: any;54}55declare module 'codecov/lib/services/drone' {56 declare module.exports: any;57}58declare module 'codecov/lib/services/gitlab' {59 declare module.exports: any;60}61declare module 'codecov/lib/services/heroku' {62 declare module.exports: any;63}64declare module 'codecov/lib/services/jenkins' {65 declare module.exports: any;66}67declare module 'codecov/lib/services/localGit' {68 declare module.exports: any;69}70declare module 'codecov/lib/services/semaphore' {71 declare module.exports: any;72}73declare module 'codecov/lib/services/semaphore2x' {74 declare module.exports: any;75}76declare module 'codecov/lib/services/shippable' {77 declare module.exports: any;78}79declare module 'codecov/lib/services/snap' {80 declare module.exports: any;81}82declare module 'codecov/lib/services/teamcity' {83 declare module.exports: any;84}85declare module 'codecov/lib/services/travis' {86 declare module.exports: any;87}88declare module 'codecov/lib/services/wercker' {89 declare module.exports: any;90}91declare module 'codecov/test/detect.test' {92 declare module.exports: any;93}94declare module 'codecov/test/git.test' {95 declare module.exports: any;96}97declare module 'codecov/test/index.test' {98 declare module.exports: any;99}100declare module 'codecov/test/services/appveyor.test' {101 declare module.exports: any;102}103declare module 'codecov/test/services/azure-pipelines.test' {104 declare module.exports: any;105}106declare module 'codecov/test/services/buildkite.test' {107 declare module.exports: any;108}109declare module 'codecov/test/services/circle.test' {110 declare module.exports: any;111}112declare module 'codecov/test/services/cirrus.test' {113 declare module.exports: any;114}115declare module 'codecov/test/services/codebuild.test' {116 declare module.exports: any;117}118declare module 'codecov/test/services/codeship.test' {119 declare module.exports: any;120}121declare module 'codecov/test/services/drone.test' {122 declare module.exports: any;123}124declare module 'codecov/test/services/gitlab.test' {125 declare module.exports: any;126}127declare module 'codecov/test/services/heroku.test' {128 declare module.exports: any;129}130declare module 'codecov/test/services/jenkins.test' {131 declare module.exports: any;132}133declare module 'codecov/test/services/localGit.test' {134 declare module.exports: any;135}136declare module 'codecov/test/services/semaphore.test' {137 declare module.exports: any;138}139declare module 'codecov/test/services/semaphore2x.test' {140 declare module.exports: any;141}142declare module 'codecov/test/services/shippable.test' {143 declare module.exports: any;144}145declare module 'codecov/test/services/snap.test' {146 declare module.exports: any;147}148declare module 'codecov/test/services/teamcity.test' {149 declare module.exports: any;150}151declare module 'codecov/test/services/travis.test' {152 declare module.exports: any;153}154declare module 'codecov/test/services/wercker.test' {155 declare module.exports: any;156}157declare module 'codecov/test/upload.test' {158 declare module.exports: any;159}160// Filename aliases161declare module 'codecov/index' {162 declare module.exports: $Exports<'codecov'>;163}164declare module 'codecov/index.js' {165 declare module.exports: $Exports<'codecov'>;166}167declare module 'codecov/lib/codecov.js' {168 declare module.exports: $Exports<'codecov/lib/codecov'>;169}170declare module 'codecov/lib/detect.js' {171 declare module.exports: $Exports<'codecov/lib/detect'>;172}173declare module 'codecov/lib/git.js' {174 declare module.exports: $Exports<'codecov/lib/git'>;175}176declare module 'codecov/lib/offline.js' {177 declare module.exports: $Exports<'codecov/lib/offline'>;178}179declare module 'codecov/lib/services/appveyor.js' {180 declare module.exports: $Exports<'codecov/lib/services/appveyor'>;181}182declare module 'codecov/lib/services/azurePipelines.js' {183 declare module.exports: $Exports<'codecov/lib/services/azurePipelines'>;184}185declare module 'codecov/lib/services/buildkite.js' {186 declare module.exports: $Exports<'codecov/lib/services/buildkite'>;187}188declare module 'codecov/lib/services/circle.js' {189 declare module.exports: $Exports<'codecov/lib/services/circle'>;190}191declare module 'codecov/lib/services/cirrus.js' {192 declare module.exports: $Exports<'codecov/lib/services/cirrus'>;193}194declare module 'codecov/lib/services/codebuild.js' {195 declare module.exports: $Exports<'codecov/lib/services/codebuild'>;196}197declare module 'codecov/lib/services/codeship.js' {198 declare module.exports: $Exports<'codecov/lib/services/codeship'>;199}200declare module 'codecov/lib/services/drone.js' {201 declare module.exports: $Exports<'codecov/lib/services/drone'>;202}203declare module 'codecov/lib/services/gitlab.js' {204 declare module.exports: $Exports<'codecov/lib/services/gitlab'>;205}206declare module 'codecov/lib/services/heroku.js' {207 declare module.exports: $Exports<'codecov/lib/services/heroku'>;208}209declare module 'codecov/lib/services/jenkins.js' {210 declare module.exports: $Exports<'codecov/lib/services/jenkins'>;211}212declare module 'codecov/lib/services/localGit.js' {213 declare module.exports: $Exports<'codecov/lib/services/localGit'>;214}215declare module 'codecov/lib/services/semaphore.js' {216 declare module.exports: $Exports<'codecov/lib/services/semaphore'>;217}218declare module 'codecov/lib/services/semaphore2x.js' {219 declare module.exports: $Exports<'codecov/lib/services/semaphore2x'>;220}221declare module 'codecov/lib/services/shippable.js' {222 declare module.exports: $Exports<'codecov/lib/services/shippable'>;223}224declare module 'codecov/lib/services/snap.js' {225 declare module.exports: $Exports<'codecov/lib/services/snap'>;226}227declare module 'codecov/lib/services/teamcity.js' {228 declare module.exports: $Exports<'codecov/lib/services/teamcity'>;229}230declare module 'codecov/lib/services/travis.js' {231 declare module.exports: $Exports<'codecov/lib/services/travis'>;232}233declare module 'codecov/lib/services/wercker.js' {234 declare module.exports: $Exports<'codecov/lib/services/wercker'>;235}236declare module 'codecov/test/detect.test.js' {237 declare module.exports: $Exports<'codecov/test/detect.test'>;238}239declare module 'codecov/test/git.test.js' {240 declare module.exports: $Exports<'codecov/test/git.test'>;241}242declare module 'codecov/test/index.test.js' {243 declare module.exports: $Exports<'codecov/test/index.test'>;244}245declare module 'codecov/test/services/appveyor.test.js' {246 declare module.exports: $Exports<'codecov/test/services/appveyor.test'>;247}248declare module 'codecov/test/services/azure-pipelines.test.js' {249 declare module.exports: $Exports<'codecov/test/services/azure-pipelines.test'>;250}251declare module 'codecov/test/services/buildkite.test.js' {252 declare module.exports: $Exports<'codecov/test/services/buildkite.test'>;253}254declare module 'codecov/test/services/circle.test.js' {255 declare module.exports: $Exports<'codecov/test/services/circle.test'>;256}257declare module 'codecov/test/services/cirrus.test.js' {258 declare module.exports: $Exports<'codecov/test/services/cirrus.test'>;259}260declare module 'codecov/test/services/codebuild.test.js' {261 declare module.exports: $Exports<'codecov/test/services/codebuild.test'>;262}263declare module 'codecov/test/services/codeship.test.js' {264 declare module.exports: $Exports<'codecov/test/services/codeship.test'>;265}266declare module 'codecov/test/services/drone.test.js' {267 declare module.exports: $Exports<'codecov/test/services/drone.test'>;268}269declare module 'codecov/test/services/gitlab.test.js' {270 declare module.exports: $Exports<'codecov/test/services/gitlab.test'>;271}272declare module 'codecov/test/services/heroku.test.js' {273 declare module.exports: $Exports<'codecov/test/services/heroku.test'>;274}275declare module 'codecov/test/services/jenkins.test.js' {276 declare module.exports: $Exports<'codecov/test/services/jenkins.test'>;277}278declare module 'codecov/test/services/localGit.test.js' {279 declare module.exports: $Exports<'codecov/test/services/localGit.test'>;280}281declare module 'codecov/test/services/semaphore.test.js' {282 declare module.exports: $Exports<'codecov/test/services/semaphore.test'>;283}284declare module 'codecov/test/services/semaphore2x.test.js' {285 declare module.exports: $Exports<'codecov/test/services/semaphore2x.test'>;286}287declare module 'codecov/test/services/shippable.test.js' {288 declare module.exports: $Exports<'codecov/test/services/shippable.test'>;289}290declare module 'codecov/test/services/snap.test.js' {291 declare module.exports: $Exports<'codecov/test/services/snap.test'>;292}293declare module 'codecov/test/services/teamcity.test.js' {294 declare module.exports: $Exports<'codecov/test/services/teamcity.test'>;295}296declare module 'codecov/test/services/travis.test.js' {297 declare module.exports: $Exports<'codecov/test/services/travis.test'>;298}299declare module 'codecov/test/services/wercker.test.js' {300 declare module.exports: $Exports<'codecov/test/services/wercker.test'>;301}302declare module 'codecov/test/upload.test.js' {303 declare module.exports: $Exports<'codecov/test/upload.test'>;...

Full Screen

Full Screen

serviceuser_v1_client.py

Source:serviceuser_v1_client.py Github

copy

Full Screen

1"""Generated client library for serviceuser version v1."""2# NOTE: This file is autogenerated and should not be edited by hand.3from apitools.base.py import base_api4from googlecloudsdk.third_party.apis.serviceuser.v1 import serviceuser_v1_messages as messages5class ServiceuserV1(base_api.BaseApiClient):6 """Generated client library for service serviceuser version v1."""7 MESSAGES_MODULE = messages8 BASE_URL = u'https://serviceuser.googleapis.com/'9 _PACKAGE = u'serviceuser'10 _SCOPES = [u'https://www.googleapis.com/auth/cloud-platform', u'https://www.googleapis.com/auth/cloud-platform.read-only', u'https://www.googleapis.com/auth/service.management']11 _VERSION = u'v1'12 _CLIENT_ID = '1042881264118.apps.googleusercontent.com'13 _CLIENT_SECRET = 'x_Tw5K8nnjoRAqULM9PFAC2b'14 _USER_AGENT = 'x_Tw5K8nnjoRAqULM9PFAC2b'15 _CLIENT_CLASS_NAME = u'ServiceuserV1'16 _URL_VERSION = u'v1'17 _API_KEY = None18 def __init__(self, url='', credentials=None,19 get_credentials=True, http=None, model=None,20 log_request=False, log_response=False,21 credentials_args=None, default_global_params=None,22 additional_http_headers=None, response_encoding=None):23 """Create a new serviceuser handle."""24 url = url or self.BASE_URL25 super(ServiceuserV1, self).__init__(26 url, credentials=credentials,27 get_credentials=get_credentials, http=http, model=model,28 log_request=log_request, log_response=log_response,29 credentials_args=credentials_args,30 default_global_params=default_global_params,31 additional_http_headers=additional_http_headers,32 response_encoding=response_encoding)33 self.projects_services = self.ProjectsServicesService(self)34 self.projects = self.ProjectsService(self)35 self.services = self.ServicesService(self)36 class ProjectsServicesService(base_api.BaseApiService):37 """Service class for the projects_services resource."""38 _NAME = u'projects_services'39 def __init__(self, client):40 super(ServiceuserV1.ProjectsServicesService, self).__init__(client)41 self._upload_configs = {42 }43 def Disable(self, request, global_params=None):44 r"""Disable a service so it can no longer be used with a.45project. This prevents unintended usage that may cause unexpected billing46charges or security leaks.47Operation<response: google.protobuf.Empty>48 Args:49 request: (ServiceuserProjectsServicesDisableRequest) input message50 global_params: (StandardQueryParameters, default: None) global arguments51 Returns:52 (Operation) The response message.53 """54 config = self.GetMethodConfig('Disable')55 return self._RunMethod(56 config, request, global_params=global_params)57 Disable.method_config = lambda: base_api.ApiMethodInfo(58 http_method=u'POST',59 method_id=u'serviceuser.projects.services.disable',60 ordered_params=[u'projectsId', u'servicesId'],61 path_params=[u'projectsId', u'servicesId'],62 query_params=[],63 relative_path=u'v1/projects/{projectsId}/services/{servicesId}:disable',64 request_field=u'disableServiceRequest',65 request_type_name=u'ServiceuserProjectsServicesDisableRequest',66 response_type_name=u'Operation',67 supports_download=False,68 )69 def Enable(self, request, global_params=None):70 r"""Enable a service so it can be used with a project.71See [Cloud Auth Guide](https://cloud.google.com/docs/authentication) for72more information.73Operation<response: google.protobuf.Empty>74 Args:75 request: (ServiceuserProjectsServicesEnableRequest) input message76 global_params: (StandardQueryParameters, default: None) global arguments77 Returns:78 (Operation) The response message.79 """80 config = self.GetMethodConfig('Enable')81 return self._RunMethod(82 config, request, global_params=global_params)83 Enable.method_config = lambda: base_api.ApiMethodInfo(84 http_method=u'POST',85 method_id=u'serviceuser.projects.services.enable',86 ordered_params=[u'projectsId', u'servicesId'],87 path_params=[u'projectsId', u'servicesId'],88 query_params=[],89 relative_path=u'v1/projects/{projectsId}/services/{servicesId}:enable',90 request_field=u'enableServiceRequest',91 request_type_name=u'ServiceuserProjectsServicesEnableRequest',92 response_type_name=u'Operation',93 supports_download=False,94 )95 def List(self, request, global_params=None):96 r"""List enabled services for the specified consumer.97 Args:98 request: (ServiceuserProjectsServicesListRequest) input message99 global_params: (StandardQueryParameters, default: None) global arguments100 Returns:101 (ListEnabledServicesResponse) The response message.102 """103 config = self.GetMethodConfig('List')104 return self._RunMethod(105 config, request, global_params=global_params)106 List.method_config = lambda: base_api.ApiMethodInfo(107 http_method=u'GET',108 method_id=u'serviceuser.projects.services.list',109 ordered_params=[u'projectsId'],110 path_params=[u'projectsId'],111 query_params=[u'pageSize', u'pageToken'],112 relative_path=u'v1/projects/{projectsId}/services',113 request_field='',114 request_type_name=u'ServiceuserProjectsServicesListRequest',115 response_type_name=u'ListEnabledServicesResponse',116 supports_download=False,117 )118 class ProjectsService(base_api.BaseApiService):119 """Service class for the projects resource."""120 _NAME = u'projects'121 def __init__(self, client):122 super(ServiceuserV1.ProjectsService, self).__init__(client)123 self._upload_configs = {124 }125 class ServicesService(base_api.BaseApiService):126 """Service class for the services resource."""127 _NAME = u'services'128 def __init__(self, client):129 super(ServiceuserV1.ServicesService, self).__init__(client)130 self._upload_configs = {131 }132 def Search(self, request, global_params=None):133 r"""Search available services.134When no filter is specified, returns all accessible services. For135authenticated users, also returns all services the calling user has136"servicemanagement.services.bind" permission for.137 Args:138 request: (ServiceuserServicesSearchRequest) input message139 global_params: (StandardQueryParameters, default: None) global arguments140 Returns:141 (SearchServicesResponse) The response message.142 """143 config = self.GetMethodConfig('Search')144 return self._RunMethod(145 config, request, global_params=global_params)146 Search.method_config = lambda: base_api.ApiMethodInfo(147 http_method=u'GET',148 method_id=u'serviceuser.services.search',149 ordered_params=[],150 path_params=[],151 query_params=[u'pageSize', u'pageToken'],152 relative_path=u'v1/services:search',153 request_field='',154 request_type_name=u'ServiceuserServicesSearchRequest',155 response_type_name=u'SearchServicesResponse',156 supports_download=False,...

Full Screen

Full Screen

sort_services_test.py

Source:sort_services_test.py Github

copy

Full Screen

1from __future__ import absolute_import2from __future__ import unicode_literals3import pytest4from compose.config.errors import DependencyError5from compose.config.sort_services import sort_service_dicts6from compose.config.types import VolumeFromSpec7class TestSortService(object):8 def test_sort_service_dicts_1(self):9 services = [10 {11 'links': ['redis'],12 'name': 'web'13 },14 {15 'name': 'grunt'16 },17 {18 'name': 'redis'19 }20 ]21 sorted_services = sort_service_dicts(services)22 assert len(sorted_services) == 323 assert sorted_services[0]['name'] == 'grunt'24 assert sorted_services[1]['name'] == 'redis'25 assert sorted_services[2]['name'] == 'web'26 def test_sort_service_dicts_2(self):27 services = [28 {29 'links': ['redis', 'postgres'],30 'name': 'web'31 },32 {33 'name': 'postgres',34 'links': ['redis']35 },36 {37 'name': 'redis'38 }39 ]40 sorted_services = sort_service_dicts(services)41 assert len(sorted_services) == 342 assert sorted_services[0]['name'] == 'redis'43 assert sorted_services[1]['name'] == 'postgres'44 assert sorted_services[2]['name'] == 'web'45 def test_sort_service_dicts_3(self):46 services = [47 {48 'name': 'child'49 },50 {51 'name': 'parent',52 'links': ['child']53 },54 {55 'links': ['parent'],56 'name': 'grandparent'57 },58 ]59 sorted_services = sort_service_dicts(services)60 assert len(sorted_services) == 361 assert sorted_services[0]['name'] == 'child'62 assert sorted_services[1]['name'] == 'parent'63 assert sorted_services[2]['name'] == 'grandparent'64 def test_sort_service_dicts_4(self):65 services = [66 {67 'name': 'child'68 },69 {70 'name': 'parent',71 'volumes_from': [VolumeFromSpec('child', 'rw', 'service')]72 },73 {74 'links': ['parent'],75 'name': 'grandparent'76 },77 ]78 sorted_services = sort_service_dicts(services)79 assert len(sorted_services) == 380 assert sorted_services[0]['name'] == 'child'81 assert sorted_services[1]['name'] == 'parent'82 assert sorted_services[2]['name'] == 'grandparent'83 def test_sort_service_dicts_5(self):84 services = [85 {86 'links': ['parent'],87 'name': 'grandparent'88 },89 {90 'name': 'parent',91 'network_mode': 'service:child'92 },93 {94 'name': 'child'95 }96 ]97 sorted_services = sort_service_dicts(services)98 assert len(sorted_services) == 399 assert sorted_services[0]['name'] == 'child'100 assert sorted_services[1]['name'] == 'parent'101 assert sorted_services[2]['name'] == 'grandparent'102 def test_sort_service_dicts_6(self):103 services = [104 {105 'links': ['parent'],106 'name': 'grandparent'107 },108 {109 'name': 'parent',110 'volumes_from': [VolumeFromSpec('child', 'ro', 'service')]111 },112 {113 'name': 'child'114 }115 ]116 sorted_services = sort_service_dicts(services)117 assert len(sorted_services) == 3118 assert sorted_services[0]['name'] == 'child'119 assert sorted_services[1]['name'] == 'parent'120 assert sorted_services[2]['name'] == 'grandparent'121 def test_sort_service_dicts_7(self):122 services = [123 {124 'network_mode': 'service:three',125 'name': 'four'126 },127 {128 'links': ['two'],129 'name': 'three'130 },131 {132 'name': 'two',133 'volumes_from': [VolumeFromSpec('one', 'rw', 'service')]134 },135 {136 'name': 'one'137 }138 ]139 sorted_services = sort_service_dicts(services)140 assert len(sorted_services) == 4141 assert sorted_services[0]['name'] == 'one'142 assert sorted_services[1]['name'] == 'two'143 assert sorted_services[2]['name'] == 'three'144 assert sorted_services[3]['name'] == 'four'145 def test_sort_service_dicts_circular_imports(self):146 services = [147 {148 'links': ['redis'],149 'name': 'web'150 },151 {152 'name': 'redis',153 'links': ['web']154 },155 ]156 with pytest.raises(DependencyError) as exc:157 sort_service_dicts(services)158 assert 'redis' in exc.exconly()159 assert 'web' in exc.exconly()160 def test_sort_service_dicts_circular_imports_2(self):161 services = [162 {163 'links': ['postgres', 'redis'],164 'name': 'web'165 },166 {167 'name': 'redis',168 'links': ['web']169 },170 {171 'name': 'postgres'172 }173 ]174 with pytest.raises(DependencyError) as exc:175 sort_service_dicts(services)176 assert 'redis' in exc.exconly()177 assert 'web' in exc.exconly()178 def test_sort_service_dicts_circular_imports_3(self):179 services = [180 {181 'links': ['b'],182 'name': 'a'183 },184 {185 'name': 'b',186 'links': ['c']187 },188 {189 'name': 'c',190 'links': ['a']191 }192 ]193 with pytest.raises(DependencyError) as exc:194 sort_service_dicts(services)195 assert 'a' in exc.exconly()196 assert 'b' in exc.exconly()197 def test_sort_service_dicts_self_imports(self):198 services = [199 {200 'links': ['web'],201 'name': 'web'202 },203 ]204 with pytest.raises(DependencyError) as exc:205 sort_service_dicts(services)206 assert 'web' in exc.exconly()207 def test_sort_service_dicts_depends_on_self(self):208 services = [209 {210 'depends_on': ['web'],211 'name': 'web'212 },213 ]214 with pytest.raises(DependencyError) as exc:215 sort_service_dicts(services)...

Full Screen

Full Screen

service_util.py

Source:service_util.py Github

copy

Full Screen

1# -*- coding: utf-8 -*- #2# Copyright 2015 Google Inc. All Rights Reserved.3#4# Licensed under the Apache License, Version 2.0 (the "License");5# you may not use this file except in compliance with the License.6# You may obtain a copy of the License at7#8# http://www.apache.org/licenses/LICENSE-2.09#10# Unless required by applicable law or agreed to in writing, software11# distributed under the License is distributed on an "AS IS" BASIS,12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13# See the License for the specific language governing permissions and14# limitations under the License.15"""Utilities for dealing with service resources."""16from __future__ import absolute_import17from __future__ import division18from __future__ import unicode_literals19from googlecloudsdk.api_lib.app import operations_util20from googlecloudsdk.core import exceptions21from googlecloudsdk.core.util import text22import six23class ServiceValidationError(exceptions.Error):24 pass25class ServicesDeleteError(exceptions.Error):26 pass27class ServicesNotFoundError(exceptions.Error):28 @classmethod29 def FromServiceLists(cls, requested_services, all_services):30 """Format a ServiceNotFoundError.31 Args:32 requested_services: list of str, IDs of services that were not found.33 all_services: list of str, IDs of all available services34 Returns:35 ServicesNotFoundError, error with properly formatted message36 """37 return cls(38 'The following {0} not found: [{1}]\n\n'39 'All services: [{2}]'.format(40 text.Pluralize(len(requested_services), 'service was',41 plural='services were'),42 ', '.join(requested_services),43 ', '.join(all_services)))44class ServicesSplitTrafficError(exceptions.Error):45 pass46class Service(object):47 """Value class representing a service resource."""48 def __init__(self, project, id_, split=None):49 self.project = project50 self.id = id_51 self.split = split or {}52 def __eq__(self, other):53 return (type(other) is Service and54 self.project == other.project and self.id == other.id)55 def __ne__(self, other):56 return not self == other57 @classmethod58 def FromResourcePath(cls, path):59 parts = path.split('/')60 if len(parts) != 2:61 raise ServiceValidationError('[{0}] is not a valid resource path. '62 'Expected <project>/<service>.')63 return cls(*parts)64 # TODO(b/25662075): convert to use functools.total_ordering65 def __lt__(self, other):66 return (self.project, self.id) < (other.project, other.id)67 def __le__(self, other):68 return (self.project, self.id) <= (other.project, other.id)69 def __gt__(self, other):70 return (self.project, self.id) > (other.project, other.id)71 def __ge__(self, other):72 return (self.project, self.id) >= (other.project, other.id)73 def __repr__(self):74 return '{0}/{1}'.format(self.project, self.id)75def _ValidateServicesAreSubset(filtered_services, all_services):76 not_found_services = set(filtered_services) - set(all_services)77 if not_found_services:78 raise ServicesNotFoundError.FromServiceLists(not_found_services,79 all_services)80def GetMatchingServices(all_services, args_services):81 """Return a list of services to act on based on user arguments.82 Args:83 all_services: list of Services representing all services in the project.84 args_services: list of string, service IDs to filter for, from arguments85 given by the user to the command line. If empty, match all services.86 Returns:87 list of matching Services sorted by the order they were given to the88 command line.89 Raises:90 ServiceValidationError: If an improper combination of arguments is given91 """92 if not args_services:93 args_services = sorted(s.id for s in all_services)94 else:95 _ValidateServicesAreSubset(args_services, [s.id for s in all_services])96 matching_services = []97 # Match the order to the order of arguments.98 for service_id in args_services:99 matching_services += [s for s in all_services if s.id == service_id]100 return matching_services101def ParseTrafficAllocations(args_allocations, split_method):102 """Parses the user-supplied allocations into a format acceptable by the API.103 Args:104 args_allocations: The raw allocations passed on the command line. A dict105 mapping version_id (str) to the allocation (float).106 split_method: Whether the traffic will be split by ip or cookie. This107 affects the format we specify the splits in.108 Returns:109 A dict mapping version id (str) to traffic split (float).110 Raises:111 ServicesSplitTrafficError: if the sum of traffic allocations is zero.112 """113 # Splitting by IP allows 2 decimal places, splitting by cookie allows 3.114 max_decimal_places = 2 if split_method == 'ip' else 3115 sum_of_splits = sum([float(s) for s in args_allocations.values()])116 err = ServicesSplitTrafficError(117 'Cannot set traffic split to zero. If you would like a version to '118 'receive no traffic, send 100% of traffic to other versions or delete '119 'the service.')120 # Prevent division by zero121 if sum_of_splits == 0.0:122 raise err123 allocations = {}124 for version, split in six.iteritems(args_allocations):125 allocation = float(split) / sum_of_splits126 allocation = round(allocation, max_decimal_places)127 if allocation == 0.0:128 raise err129 allocations[version] = allocation130 # The API requires that these sum to 1.0. This is hard to get exactly correct,131 # (think .33, .33, .33) so we take our difference and subtract it from the132 # first maximum element of our sorted allocations dictionary133 total_splits = round(sum(allocations.values()), max_decimal_places)134 difference = total_splits - 1.0135 max_split = max(allocations.values())136 for version, split in sorted(allocations.items()):137 if max_split == split:138 allocations[version] -= difference139 break140 return allocations141def DeleteServices(api_client, services):142 """Delete the given services."""143 errors = {}144 for service in services:145 try:146 operations_util.CallAndCollectOpErrors(147 api_client.DeleteService, service.id)148 except operations_util.MiscOperationError as err:149 errors[service.id] = str(err)150 if errors:151 printable_errors = {}152 for service_id, error_msg in errors.items():153 printable_errors[service_id] = '[{0}]: {1}'.format(service_id,154 error_msg)155 raise ServicesDeleteError(156 'Issue deleting {0}: [{1}]\n\n'.format(157 text.Pluralize(len(printable_errors), 'service'),158 ', '.join(list(printable_errors.keys()))) +...

Full Screen

Full Screen

index.js

Source:index.js Github

copy

Full Screen

1import React from 'react'2import Icon1 from '../../images/svg-1.svg'3import Icon2 from '../../images/svg-2.svg'4import Icon3 from '../../images/svg-3.svg'5import { useTranslation } from 'react-i18next';6import { ServicesContainer, ServicesH1, ServicesWrapper, ServicesIcon, ServicesCard, ServicesH2, ServicesP, } from './ServicesElements'7const Services = () => {8 const { t } = useTranslation();9 return (10 <ServicesContainer id="services">11 <ServicesH1>{t('ServicesH1')}</ServicesH1>12 <ServicesWrapper>13 <ServicesCard>14 <ServicesIcon src={Icon1} />15 <ServicesH2>{t('Flexible')}</ServicesH2>16 <ServicesP>{t('FlexP')}</ServicesP>17 </ServicesCard>18 <ServicesCard>19 <ServicesIcon src={Icon2} />20 <ServicesH2>{t('BiLingual')}</ServicesH2>21 <ServicesP>{t('BiLingualP')}</ServicesP>22 </ServicesCard>23 <ServicesCard>24 <ServicesIcon src={Icon3} />25 <ServicesH2>{t('Mobile')}</ServicesH2>26 <ServicesP>{t('MobileP')}</ServicesP>27 </ServicesCard>28 </ServicesWrapper>29 </ServicesContainer>30 )31}...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1import { MockBuilder, MockRender, ngMocks } from 'ng-mocks';2const mock = ngMocks.findInstance(MyService);3import { MockBuilder, MockRender, ngMocks } from 'ng-mocks';4const mock = TestBed.inject(MyService);5import { MockBuilder, MockRender, ngMocks } from 'ng-mocks';6const mock = ngMocks.create(MyService);7import { MockBuilder, MockRender, ngMocks } from 'ng-mocks';8const mock = ngMocks.create(MyService);9import { MockBuilder, MockRender, ngMocks } from 'ng-mocks';10const mock = ngMocks.create(MyService);11import { MockBuilder, MockRender, ngMocks } from 'ng-mocks';12const mock = ngMocks.create(MyService);13import { MockBuilder, MockRender, ngMocks } from 'ng-mocks';14const mock = ngMocks.create(MyService);15import { MockBuilder, MockRender, ngMocks } from 'ng-mocks';16const mock = ngMocks.create(MyService);17import { MockBuilder, MockRender, ngMocks } from 'ng-mocks';18const mock = ngMocks.create(MyService);19import { MockBuilder, MockRender, ngMocks } from 'ng-mocks';20const mock = ngMocks.create(MyService);21import { MockBuilder, MockRender, ngMocks } from 'ng-mocks';22const mock = ngMocks.create(MyService);23import { MockBuilder, MockRender, ngMocks } from 'ng-mocks';24const mock = ngMocks.create(MyService);25import { MockBuilder, MockRender, ngMocks } from 'ng-mocks';26const mock = ngMocks.create(MyService);27import { MockBuilder, MockRender, ngMocks } from 'ng-mocks';

Full Screen

Using AI Code Generation

copy

Full Screen

1import { services } from 'ng-mocks';2import { ngMocks } from 'ng-mocks';3describe('my test', () => {4 let service: MyService;5 let httpMock: HttpTestingController;6 let http: HttpClient;7 beforeEach(() => {8 TestBed.configureTestingModule({9 imports: [HttpClientModule],10 });11 service = TestBed.inject(MyService);12 httpMock = TestBed.inject(HttpTestingController);13 http = TestBed.inject(HttpClient);14 });15 it('should test', () => {16 service.testMethod();17 http.get('test').subscribe();18 });19});20import { get } from 'ng-mocks';21describe('my test', () => {22 let service: MyService;23 let httpMock: HttpTestingController;24 let http: HttpClient;25 beforeEach(() => {26 TestBed.configureTestingModule({27 imports: [HttpClientModule],28 });29 service = get(MyService);30 httpMock = get(HttpTestingController);31 http = get(HttpClient);32 });33 it('should test', () => {34 service.testMethod();35 http.get('test').subscribe

Full Screen

Using AI Code Generation

copy

Full Screen

1var services = require('ng-mocks/lib/services');2describe('Test Services', function() {3 beforeEach(angular.mock.module('ngMock'));4 it('test', function() {5 var $httpBackend = services.$httpBackend;6 var $http = services.$http;7 var $q = services.$q;8 var $rootScope = services.$rootScope;9 var $timeout = services.$timeout;10 var $interval = services.$interval;11 var $window = services.$window;12 var $log = services.$log;13 var $compile = services.$compile;14 var $controller = services.$controller;15 var $templateCache = services.$templateCache;16 var $injector = services.$injector;17 var $document = services.$document;18 var $animate = services.$animate;19 var $filter = services.$filter;20 var $translate = services.$translate;21 });22});23var services = require('ng-mocks/lib/services');24describe('Test Services', function() {25 beforeEach(angular.mock.module('ngMock'));26 it('test', function() {27 var $httpBackend = services.$httpBackend;28 var $http = services.$http;29 var $q = services.$q;30 var $rootScope = services.$rootScope;31 var $timeout = services.$timeout;32 var $interval = services.$interval;33 var $window = services.$window;34 var $log = services.$log;35 var $compile = services.$compile;36 var $controller = services.$controller;37 var $templateCache = services.$templateCache;38 var $injector = services.$injector;39 var $document = services.$document;

Full Screen

Using AI Code Generation

copy

Full Screen

1describe('TestController', function() {2 var $scope, $controller, $httpBackend, $http, $templateCache, $compile, $rootScope, $location, $window, $document;3 beforeEach(module('testApp'));4 beforeEach(inject(function(_$controller_, _$rootScope_, _$httpBackend_, _$http_, _$templateCache_, _$compile_, _$location_, _$window_, _$document_) {5 $scope = _$rootScope_.$new();6 $controller = _$controller_;7 $httpBackend = _$httpBackend_;8 $http = _$http_;9 $templateCache = _$templateCache_;10 $compile = _$compile_;11 $rootScope = _$rootScope_;12 $location = _$location_;13 $window = _$window_;14 $document = _$document_;15 $httpBackend.whenGET('test.html').respond('<div>test</div>');16 }));17 describe('TestController', function() {18 it('should be able to get the template', function() {19 $httpBackend.expectGET('test.html');20 $httpBackend.flush();21 });22 });23});24angular.module('testApp').factory('testService', function() {25 return {26 testMethod: function() {27 return 'test';28 }29 }30});31describe('TestController', function() {32 var $scope, $controller, $httpBackend, $http, $templateCache, $compile, $rootScope, $location, $window, $document;33 beforeEach(module('testApp'));34 beforeEach(inject(function(_$controller_, _$rootScope_, _$httpBackend_, _$http_, _$templateCache_, _$compile_, _$location_, _$window_, _$document_, testService) {

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run ng-mocks automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful