How to use anything method in stryker-parent

Best JavaScript code snippet using stryker-parent

nova_tests.py

Source:nova_tests.py Github

copy

Full Screen

1# Copyright 2012 United States Government as represented by the2# Administrator of the National Aeronautics and Space Administration.3# All Rights Reserved.4#5# Copyright 2012 Nebula, Inc.6# Copyright (c) 2012 X.commerce, a business unit of eBay Inc.7#8# Licensed under the Apache License, Version 2.0 (the "License"); you may9# not use this file except in compliance with the License. You may obtain10# a copy of the License at11#12# http://www.apache.org/licenses/LICENSE-2.013#14# Unless required by applicable law or agreed to in writing, software15# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT16# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the17# License for the specific language governing permissions and limitations18# under the License.19from __future__ import absolute_import20from django.conf import settings21from django import http22from django.test.utils import override_settings23from mox3.mox import IsA24from novaclient import api_versions25from novaclient import exceptions as nova_exceptions26from novaclient.v2 import flavor_access as nova_flavor_access27from novaclient.v2 import servers28from horizon import exceptions as horizon_exceptions29from openstack_dashboard import api30from openstack_dashboard.test import helpers as test31class ServerWrapperTests(test.TestCase):32 def test_get_base_attribute(self):33 server = api.nova.Server(self.servers.first(), self.request)34 self.assertEqual(self.servers.first().id, server.id)35 def test_image_name(self):36 image = self.images.first()37 self.mox.StubOutWithMock(api.glance, 'image_get')38 api.glance.image_get(IsA(http.HttpRequest),39 image.id).AndReturn(image)40 self.mox.ReplayAll()41 server = api.nova.Server(self.servers.first(), self.request)42 self.assertEqual(image.name, server.image_name)43 def test_image_name_no_glance_service(self):44 server = self.servers.first()45 self.mox.StubOutWithMock(api.glance, 'image_get')46 api.glance.image_get(IsA(http.HttpRequest),47 server.image['id']).AndRaise(48 horizon_exceptions.ServiceCatalogException('image'))49 self.mox.ReplayAll()50 server = api.nova.Server(server, self.request)51 self.assertEqual('(not found)', server.image_name)52 self.assertIsNone(server.image_name)53class ComputeApiTests(test.APITestCase):54 def test_server_reboot(self):55 server = self.servers.first()56 HARDNESS = servers.REBOOT_HARD57 novaclient = self.stub_novaclient()58 novaclient.servers = self.mox.CreateMockAnything()59 novaclient.servers.reboot(server.id, HARDNESS)60 self.mox.ReplayAll()61 ret_val = api.nova.server_reboot(self.request, server.id)62 self.assertIsNone(ret_val)63 def test_server_soft_reboot(self):64 server = self.servers.first()65 HARDNESS = servers.REBOOT_SOFT66 novaclient = self.stub_novaclient()67 novaclient.servers = self.mox.CreateMockAnything()68 novaclient.servers.reboot(server.id, HARDNESS)69 self.mox.ReplayAll()70 ret_val = api.nova.server_reboot(self.request, server.id, HARDNESS)71 self.assertIsNone(ret_val)72 def test_server_vnc_console(self):73 server = self.servers.first()74 console = self.servers.vnc_console_data75 console_type = console["console"]["type"]76 novaclient = self.stub_novaclient()77 novaclient.servers = self.mox.CreateMockAnything()78 novaclient.servers.get_vnc_console(server.id,79 console_type).AndReturn(console)80 self.mox.ReplayAll()81 ret_val = api.nova.server_vnc_console(self.request,82 server.id,83 console_type)84 self.assertIsInstance(ret_val, api.nova.VNCConsole)85 def test_server_spice_console(self):86 server = self.servers.first()87 console = self.servers.spice_console_data88 console_type = console["console"]["type"]89 novaclient = self.stub_novaclient()90 novaclient.servers = self.mox.CreateMockAnything()91 novaclient.servers.get_spice_console(server.id,92 console_type).AndReturn(console)93 self.mox.ReplayAll()94 ret_val = api.nova.server_spice_console(self.request,95 server.id,96 console_type)97 self.assertIsInstance(ret_val, api.nova.SPICEConsole)98 def test_server_rdp_console(self):99 server = self.servers.first()100 console = self.servers.rdp_console_data101 console_type = console["console"]["type"]102 novaclient = self.stub_novaclient()103 novaclient.servers = self.mox.CreateMockAnything()104 novaclient.servers.get_rdp_console(server.id,105 console_type).AndReturn(console)106 self.mox.ReplayAll()107 ret_val = api.nova.server_rdp_console(self.request,108 server.id,109 console_type)110 self.assertIsInstance(ret_val, api.nova.RDPConsole)111 def test_server_list(self):112 servers = self.servers.list()113 novaclient = self.stub_novaclient()114 novaclient.servers = self.mox.CreateMockAnything()115 novaclient.versions = self.mox.CreateMockAnything()116 novaclient.versions.get_current().AndReturn("2.45")117 novaclient.servers.list(True, {'all_tenants': True}).AndReturn(servers)118 self.mox.ReplayAll()119 ret_val, has_more = api.nova.server_list(120 self.request,121 search_opts={'all_tenants': True})122 for server in ret_val:123 self.assertIsInstance(server, api.nova.Server)124 def test_server_list_pagination(self):125 page_size = getattr(settings, 'API_RESULT_PAGE_SIZE', 20)126 servers = self.servers.list()127 novaclient = self.stub_novaclient()128 novaclient.servers = self.mox.CreateMockAnything()129 novaclient.versions = self.mox.CreateMockAnything()130 novaclient.versions.get_current().AndReturn("2.45")131 novaclient.servers.list(True,132 {'all_tenants': True,133 'marker': None,134 'limit': page_size + 1}).AndReturn(servers)135 self.mox.ReplayAll()136 ret_val, has_more = api.nova.server_list(self.request,137 {'marker': None,138 'paginate': True,139 'all_tenants': True})140 for server in ret_val:141 self.assertIsInstance(server, api.nova.Server)142 self.assertFalse(has_more)143 @override_settings(API_RESULT_PAGE_SIZE=1)144 def test_server_list_pagination_more(self):145 page_size = getattr(settings, 'API_RESULT_PAGE_SIZE', 1)146 servers = self.servers.list()147 novaclient = self.stub_novaclient()148 novaclient.servers = self.mox.CreateMockAnything()149 novaclient.versions = self.mox.CreateMockAnything()150 novaclient.versions.get_current().AndReturn("2.45")151 novaclient.servers.list(True,152 {'all_tenants': True,153 'marker': None,154 'limit': page_size + 1}) \155 .AndReturn(servers[:page_size + 1])156 self.mox.ReplayAll()157 ret_val, has_more = api.nova.server_list(self.request,158 {'marker': None,159 'paginate': True,160 'all_tenants': True})161 for server in ret_val:162 self.assertIsInstance(server, api.nova.Server)163 self.assertEqual(page_size, len(ret_val))164 self.assertTrue(has_more)165 def test_usage_get(self):166 novaclient = self.stub_novaclient()167 novaclient.versions = self.mox.CreateMockAnything()168 novaclient.versions.get_current().AndReturn(169 api_versions.APIVersion('2.1'))170 novaclient.usage = self.mox.CreateMockAnything()171 novaclient.usage.get(self.tenant.id,172 'start',173 'end').AndReturn(self.usages.first())174 self.mox.ReplayAll()175 ret_val = api.nova.usage_get(self.request, self.tenant.id,176 'start', 'end')177 self.assertIsInstance(ret_val, api.nova.NovaUsage)178 def test_usage_get_paginated(self):179 novaclient = self.stub_novaclient()180 novaclient.versions = self.mox.CreateMockAnything()181 novaclient.versions.get_current().AndReturn(182 api_versions.APIVersion('2.40'))183 novaclient.api_version = api_versions.APIVersion('2.40')184 novaclient.usage = self.mox.CreateMockAnything()185 novaclient.usage.get(self.tenant.id, 'start', 'end')\186 .AndReturn(self.usages.first())187 novaclient.usage.get(188 self.tenant.id,189 'start',190 'end',191 marker=u'063cf7f3-ded1-4297-bc4c-31eae876cc93',192 ).AndReturn({})193 self.mox.ReplayAll()194 ret_val = api.nova.usage_get(self.request, self.tenant.id,195 'start', 'end')196 self.assertIsInstance(ret_val, api.nova.NovaUsage)197 def test_usage_list(self):198 usages = self.usages.list()199 novaclient = self.stub_novaclient()200 novaclient.versions = self.mox.CreateMockAnything()201 novaclient.versions.get_current().AndReturn(202 api_versions.APIVersion('2.1'))203 novaclient.usage = self.mox.CreateMockAnything()204 novaclient.usage.list('start', 'end', True).AndReturn(usages)205 self.mox.ReplayAll()206 ret_val = api.nova.usage_list(self.request, 'start', 'end')207 for usage in ret_val:208 self.assertIsInstance(usage, api.nova.NovaUsage)209 def test_usage_list_paginated(self):210 usages = self.usages.list()211 novaclient = self.stub_novaclient()212 novaclient.versions = self.mox.CreateMockAnything()213 novaclient.versions.get_current().AndReturn(214 api_versions.APIVersion('2.40'))215 novaclient.api_version = api_versions.APIVersion('2.40')216 novaclient.usage = self.mox.CreateMockAnything()217 novaclient.usage.list('start', 'end', True).AndReturn(usages)218 novaclient.usage.list(219 'start',220 'end',221 True,222 marker=u'063cf7f3-ded1-4297-bc4c-31eae876cc93',223 ).AndReturn({})224 self.mox.ReplayAll()225 ret_val = api.nova.usage_list(self.request, 'start', 'end')226 for usage in ret_val:227 self.assertIsInstance(usage, api.nova.NovaUsage)228 def test_server_get(self):229 server = self.servers.first()230 novaclient = self.stub_novaclient()231 novaclient.versions = self.mox.CreateMockAnything()232 novaclient.versions.get_current().AndReturn("2.45")233 novaclient.servers = self.mox.CreateMockAnything()234 novaclient.servers.get(server.id).AndReturn(server)235 self.mox.ReplayAll()236 ret_val = api.nova.server_get(self.request, server.id)237 self.assertIsInstance(ret_val, api.nova.Server)238 def test_server_metadata_update(self):239 server = self.servers.first()240 metadata = {'foo': 'bar'}241 novaclient = self.stub_novaclient()242 novaclient.servers = self.mox.CreateMockAnything()243 novaclient.servers.set_meta(server.id, metadata)244 self.mox.ReplayAll()245 ret_val = api.nova.server_metadata_update(self.request,246 server.id,247 metadata)248 self.assertIsNone(ret_val)249 def test_server_metadata_delete(self):250 server = self.servers.first()251 keys = ['a', 'b']252 novaclient = self.stub_novaclient()253 novaclient.servers = self.mox.CreateMockAnything()254 novaclient.servers.delete_meta(server.id, keys)255 self.mox.ReplayAll()256 ret_val = api.nova.server_metadata_delete(self.request,257 server.id,258 keys)259 self.assertIsNone(ret_val)260 def _test_absolute_limits(self, values, expected_results):261 limits = self.mox.CreateMockAnything()262 limits.absolute = []263 for key, val in values.items():264 limit = self.mox.CreateMockAnything()265 limit.name = key266 limit.value = val267 limits.absolute.append(limit)268 novaclient = self.stub_novaclient()269 novaclient.limits = self.mox.CreateMockAnything()270 novaclient.limits.get(reserved=True).AndReturn(limits)271 self.mox.ReplayAll()272 ret_val = api.nova.tenant_absolute_limits(self.request, reserved=True)273 for key in expected_results.keys():274 self.assertEqual(expected_results[key], ret_val[key])275 def test_absolute_limits_handle_unlimited(self):276 values = {"maxTotalCores": -1, "maxTotalInstances": 10}277 expected_results = {"maxTotalCores": float("inf"),278 "maxTotalInstances": 10}279 self._test_absolute_limits(values, expected_results)280 def test_absolute_limits_negative_used_workaround(self):281 values = {"maxTotalCores": -1,282 "maxTotalInstances": 10,283 "totalInstancesUsed": -1,284 "totalCoresUsed": -1,285 "totalRAMUsed": -2048,286 "totalSecurityGroupsUsed": 1,287 "totalFloatingIpsUsed": 0,288 }289 expected_results = {"maxTotalCores": float("inf"),290 "maxTotalInstances": 10,291 "totalInstancesUsed": 0,292 "totalCoresUsed": 0,293 "totalRAMUsed": 0,294 "totalSecurityGroupsUsed": 1,295 "totalFloatingIpsUsed": 0,296 }297 self._test_absolute_limits(values, expected_results)298 def test_cold_migrate_host_succeed(self):299 hypervisor = self.hypervisors.first()300 novaclient = self.stub_novaclient()301 novaclient.hypervisors = self.mox.CreateMockAnything()302 novaclient.hypervisors.search('host', True).AndReturn([hypervisor])303 novaclient.servers = self.mox.CreateMockAnything()304 novaclient.servers.migrate("test_uuid")305 self.mox.ReplayAll()306 ret_val = api.nova.migrate_host(self.request, "host", False, True,307 True)308 self.assertTrue(ret_val)309 def test_cold_migrate_host_fails(self):310 hypervisor = self.hypervisors.first()311 novaclient = self.stub_novaclient()312 novaclient.hypervisors = self.mox.CreateMockAnything()313 novaclient.hypervisors.search('host', True).AndReturn([hypervisor])314 novaclient.servers = self.mox.CreateMockAnything()315 novaclient.servers.migrate("test_uuid").AndRaise(316 nova_exceptions.ClientException(404))317 self.mox.ReplayAll()318 self.assertRaises(nova_exceptions.ClientException,319 api.nova.migrate_host,320 self.request, "host", False, True, True)321 def test_live_migrate_host_with_active_vm(self):322 hypervisor = self.hypervisors.first()323 server = self.servers.first()324 novaclient = self.stub_novaclient()325 server_uuid = hypervisor.servers[0]["uuid"]326 novaclient.versions = self.mox.CreateMockAnything()327 novaclient.versions.get_current().AndReturn("2.45")328 novaclient.hypervisors = self.mox.CreateMockAnything()329 novaclient.hypervisors.search('host', True).AndReturn([hypervisor])330 novaclient.servers = self.mox.CreateMockAnything()331 novaclient.servers.get(server_uuid).AndReturn(server)332 novaclient.servers.live_migrate(server_uuid, None, True, True)333 self.mox.ReplayAll()334 ret_val = api.nova.migrate_host(self.request, "host", True, True,335 True)336 self.assertTrue(ret_val)337 def test_live_migrate_host_with_paused_vm(self):338 hypervisor = self.hypervisors.first()339 server = self.servers.list()[3]340 novaclient = self.stub_novaclient()341 server_uuid = hypervisor.servers[0]["uuid"]342 novaclient.versions = self.mox.CreateMockAnything()343 novaclient.versions.get_current().AndReturn("2.45")344 novaclient.hypervisors = self.mox.CreateMockAnything()345 novaclient.hypervisors.search('host', True).AndReturn([hypervisor])346 novaclient.servers = self.mox.CreateMockAnything()347 novaclient.servers.get(server_uuid).AndReturn(server)348 novaclient.servers.live_migrate(server_uuid, None, True, True)349 self.mox.ReplayAll()350 ret_val = api.nova.migrate_host(self.request, "host", True, True,351 True)352 self.assertTrue(ret_val)353 def test_live_migrate_host_without_running_vm(self):354 hypervisor = self.hypervisors.first()355 server = self.servers.list()[1]356 novaclient = self.stub_novaclient()357 server_uuid = hypervisor.servers[0]["uuid"]358 novaclient.versions = self.mox.CreateMockAnything()359 novaclient.versions.get_current().AndReturn("2.45")360 novaclient.hypervisors = self.mox.CreateMockAnything()361 novaclient.hypervisors.search('host', True).AndReturn([hypervisor])362 novaclient.servers = self.mox.CreateMockAnything()363 novaclient.servers.get(server_uuid).AndReturn(server)364 novaclient.servers.migrate(server_uuid)365 self.mox.ReplayAll()366 ret_val = api.nova.migrate_host(self.request, "host", True, True,367 True)368 self.assertTrue(ret_val)369 """Flavor Tests"""370 def test_flavor_list_no_extras(self):371 flavors = self.flavors.list()372 novaclient = self.stub_novaclient()373 novaclient.flavors = self.mox.CreateMockAnything()374 novaclient.flavors.list(is_public=True).AndReturn(flavors)375 self.mox.ReplayAll()376 api_flavors = api.nova.flavor_list(self.request)377 self.assertEqual(len(flavors), len(api_flavors))378 def test_flavor_get_no_extras(self):379 flavor = self.flavors.list()[1]380 novaclient = self.stub_novaclient()381 novaclient.flavors = self.mox.CreateMockAnything()382 novaclient.flavors.get(flavor.id).AndReturn(flavor)383 self.mox.ReplayAll()384 api_flavor = api.nova.flavor_get(self.request, flavor.id)385 self.assertEqual(api_flavor.id, flavor.id)386 def _test_flavor_list_paged(self, reversed_order=False, paginate=True):387 page_size = getattr(settings, 'API_RESULT_PAGE_SIZE', 20)388 flavors = self.flavors.list()389 order = 'asc' if reversed_order else 'desc'390 novaclient = self.stub_novaclient()391 novaclient.flavors = self.mox.CreateMockAnything()392 if paginate:393 novaclient.flavors.list(is_public=True,394 marker=None,395 limit=page_size + 1,396 sort_key='name',397 sort_dir=order).AndReturn(flavors)398 else:399 novaclient.flavors.list(is_public=True).AndReturn(flavors)400 self.mox.ReplayAll()401 api_flavors, has_more, has_prev = api.nova\402 .flavor_list_paged(403 self.request,404 True,405 False,406 None,407 paginate=paginate,408 reversed_order=reversed_order)409 for flavor in api_flavors:410 self.assertIsInstance(flavor, type(flavors[0]))411 self.assertFalse(has_more)412 self.assertFalse(has_prev)413 @override_settings(API_RESULT_PAGE_SIZE=1)414 def test_flavor_list_pagination_more_and_prev(self):415 page_size = getattr(settings, 'API_RESULT_PAGE_SIZE', 1)416 flavors = self.flavors.list()417 marker = flavors[0].id418 novaclient = self.stub_novaclient()419 novaclient.flavors = self.mox.CreateMockAnything()420 novaclient.flavors.list(is_public=True,421 marker=marker,422 limit=page_size + 1,423 sort_key='name',424 sort_dir='desc')\425 .AndReturn(flavors[1:page_size + 2])426 self.mox.ReplayAll()427 api_flavors, has_more, has_prev = api.nova\428 .flavor_list_paged(429 self.request,430 True,431 False,432 marker,433 paginate=True)434 for flavor in api_flavors:435 self.assertIsInstance(flavor, type(flavors[0]))436 self.assertEqual(page_size, len(api_flavors))437 self.assertTrue(has_more)438 self.assertTrue(has_prev)439 def test_flavor_list_paged_default_order(self):440 self._test_flavor_list_paged()441 def test_flavor_list_paged_reversed_order(self):442 self._test_flavor_list_paged(reversed_order=True)443 def test_flavor_list_paged_paginate_false(self):444 self._test_flavor_list_paged(paginate=False)445 def test_flavor_create(self):446 flavor = self.flavors.first()447 novaclient = self.stub_novaclient()448 novaclient.flavors = self.mox.CreateMockAnything()449 novaclient.flavors.create(flavor.name, flavor.ram,450 flavor.vcpus, flavor.disk,451 flavorid='auto',452 ephemeral=0,453 swap=0,454 is_public=True,455 rxtx_factor=1).AndReturn(flavor)456 self.mox.ReplayAll()457 api_flavor = api.nova.flavor_create(self.request,458 flavor.name,459 flavor.ram,460 flavor.vcpus,461 flavor.disk)462 self.assertIsInstance(api_flavor, type(flavor))463 self.assertEqual(flavor.name, api_flavor.name)464 self.assertEqual(flavor.ram, api_flavor.ram)465 self.assertEqual(flavor.vcpus, api_flavor.vcpus)466 self.assertEqual(flavor.disk, api_flavor.disk)467 self.assertEqual(0, api_flavor.ephemeral)468 self.assertEqual(0, api_flavor.swap)469 self.assertTrue(api_flavor.is_public)470 self.assertEqual(1, api_flavor.rxtx_factor)471 def test_flavor_delete(self):472 flavor = self.flavors.first()473 novaclient = self.stub_novaclient()474 novaclient.flavors = self.mox.CreateMockAnything()475 novaclient.flavors.delete(flavor.id)476 self.mox.ReplayAll()477 api_val = api.nova.flavor_delete(self.request, flavor.id)478 self.assertIsNone(api_val)479 @test.create_stubs({api.nova: ('flavor_access_list',)})480 def test_flavor_access_list(self):481 flavor_access = self.flavor_access.list()482 flavor = [f for f in self.flavors.list() if f.id ==483 flavor_access[0].flavor_id][0]484 api.nova.flavor_access_list(self.request, flavor)\485 .AndReturn(flavor_access)486 self.mox.ReplayAll()487 api_flavor_access = api.nova.flavor_access_list(self.request, flavor)488 self.assertEqual(len(flavor_access), len(api_flavor_access))489 for access in api_flavor_access:490 self.assertIsInstance(access, nova_flavor_access.FlavorAccess)491 self.assertEqual(access.flavor_id, flavor.id)492 def test_add_tenant_to_flavor(self):493 flavor_access = [self.flavor_access.first()]494 flavor = [f for f in self.flavors.list() if f.id ==495 flavor_access[0].flavor_id][0]496 tenant = [t for t in self.tenants.list() if t.id ==497 flavor_access[0].tenant_id][0]498 novaclient = self.stub_novaclient()499 novaclient.flavors = self.mox.CreateMockAnything()500 novaclient.flavor_access = self.mox.CreateMockAnything()501 novaclient.flavor_access\502 .add_tenant_access(flavor=flavor,503 tenant=tenant)\504 .AndReturn(flavor_access)505 self.mox.ReplayAll()506 api_flavor_access = api.nova.add_tenant_to_flavor(self.request,507 flavor,508 tenant)509 self.assertIsInstance(api_flavor_access, list)510 self.assertEqual(len(flavor_access), len(api_flavor_access))511 for access in api_flavor_access:512 self.assertEqual(access.flavor_id, flavor.id)513 self.assertEqual(access.tenant_id, tenant.id)514 def test_remove_tenant_from_flavor(self):515 flavor_access = [self.flavor_access.first()]516 flavor = [f for f in self.flavors.list() if f.id ==517 flavor_access[0].flavor_id][0]518 tenant = [t for t in self.tenants.list() if t.id ==519 flavor_access[0].tenant_id][0]520 novaclient = self.stub_novaclient()521 novaclient.flavors = self.mox.CreateMockAnything()522 novaclient.flavor_access = self.mox.CreateMockAnything()523 novaclient.flavor_access\524 .remove_tenant_access(flavor=flavor,525 tenant=tenant)\526 .AndReturn([])527 self.mox.ReplayAll()528 api_val = api.nova.remove_tenant_from_flavor(self.request,529 flavor,530 tenant)531 self.assertEqual(len(api_val), len([]))532 self.assertIsInstance(api_val, list)533 def test_server_group_list(self):534 server_groups = self.server_groups.list()535 novaclient = self.stub_novaclient()536 novaclient.server_groups = self.mox.CreateMockAnything()537 novaclient.server_groups.list().AndReturn(server_groups)538 self.mox.ReplayAll()539 ret_val = api.nova.server_group_list(self.request)540 self.assertIsInstance(ret_val, list)...

Full Screen

Full Screen

test_routes.py

Source:test_routes.py Github

copy

Full Screen

1#!/usr/bin/env python2# -*- coding: utf-8 -*-3"""Unit tests for rewrite.py regex routing option"""4import sys5import os6import unittest7import tempfile8import logging9if os.path.isdir('gluon'):10 sys.path.insert(0,os.path.realpath('gluon')) # running from web2py base11else:12 sys.path.insert(0,os.path.realpath('../')) # running from gluon/tests/13 os.environ['web2py_path'] = os.path.realpath('../../') # for settings14from gluon.rewrite import load, filter_url, filter_err, get_effective_router, regex_filter_out, regex_select15from gluon.html import URL16from gluon.fileutils import abspath17from gluon.settings import global_settings18from gluon.http import HTTP19from gluon.storage import Storage20logger = None21oldcwd = None22root = None23def norm_root(root):24 return root.replace('/', os.sep)25def setUpModule():26 def make_apptree():27 "build a temporary applications tree"28 # applications/29 os.mkdir(abspath('applications'))30 # applications/app/31 for app in ('admin', 'examples', 'welcome'):32 os.mkdir(abspath('applications', app))33 # applications/app/(controllers, static)34 for subdir in ('controllers', 'static'):35 os.mkdir(abspath('applications', app, subdir))36 # applications/admin/controllers/*.py37 for ctr in ('appadmin', 'default', 'gae', 'mercurial', 'shell', 'wizard'):38 open(abspath('applications', 'admin',39 'controllers', '%s.py' % ctr), 'w').close()40 # applications/examples/controllers/*.py41 for ctr in ('ajax_examples', 'appadmin', 'default', 'global', 'spreadsheet'):42 open(abspath('applications', 'examples',43 'controllers', '%s.py' % ctr), 'w').close()44 # applications/welcome/controllers/*.py45 for ctr in ('appadmin', 'default'):46 open(abspath('applications', 'welcome',47 'controllers', '%s.py' % ctr), 'w').close()48 # create an app-specific routes.py for examples app49 routes = open(abspath('applications', 'examples', 'routes.py'), 'w')50 routes.write("default_function='exdef'\n")51 routes.close()52 global oldcwd53 if oldcwd is None: # do this only once54 oldcwd = os.getcwd()55 if not os.path.isdir('gluon'):56 os.chdir(os.path.realpath(57 '../../')) # run from web2py base directory58 import main # for initialization after chdir59 global logger60 logger = logging.getLogger('web2py.rewrite')61 global_settings.applications_parent = tempfile.mkdtemp()62 global root63 root = global_settings.applications_parent64 make_apptree()65def tearDownModule():66 global oldcwd67 if oldcwd is not None:68 os.chdir(oldcwd)69 oldcwd = None70class TestRoutes(unittest.TestCase):71 """ Tests the regex routing logic from gluon.rewrite """72 def test_routes_null(self):73 """ Tests a null routes table """74 load(data='')75 # incoming76 self.assertEqual(77 filter_url('http://domain.com'), '/init/default/index')78 self.assertEqual(79 filter_url('http://domain.com/'), '/init/default/index')80 self.assertEqual(81 filter_url('http://domain.com/abc'), '/abc/default/index')82 self.assertEqual(83 filter_url('http://domain.com/abc/'), '/abc/default/index')84 self.assertEqual(85 filter_url('http://domain.com/abc/def'), "/abc/def/index")86 self.assertEqual(87 filter_url('http://domain.com/abc/def/'), "/abc/def/index")88 self.assertEqual(89 filter_url('http://domain.com/abc/def/ghi'), "/abc/def/ghi")90 self.assertEqual(91 filter_url('http://domain.com/abc/def/ghi/'), "/abc/def/ghi")92 self.assertEqual(filter_url(93 'http://domain.com/abc/def/ghi/jkl'), "/abc/def/ghi ['jkl']")94 self.assertEqual(filter_url(95 'http://domain.com/abc/def/ghi/j%20kl'), "/abc/def/ghi ['j_kl']")96 self.assertEqual(filter_url('http://domain.com/welcome/static/path/to/static'),97 norm_root("%s/applications/welcome/static/path/to/static" % root))98 # no more necessary since explcit check for directory traversal attacks99 """100 self.assertRaises(HTTP, filter_url, 'http://domain.com/welcome/static/bad/path/to/st~tic')101 try:102 # 2.7+ only103 self.assertRaisesRegexp(HTTP, "400.*BAD REQUEST \[invalid path\]", filter_url, 'http://domain.com/welcome/static/bad/path/to/st~tic')104 except AttributeError:105 pass106 """107 # outgoing108 self.assertEqual(filter_url('http://domain.com/init/default/index',109 out=True), '/init/default/index')110 self.assertEqual(filter_url('http://domain.com/init/default/index/arg1', out=True), '/init/default/index/arg1')111 self.assertEqual(filter_url('http://domain.com/init/default/abc',112 out=True), '/init/default/abc')113 def test_routes_query(self):114 """ Test query appending """115 data = r'''116routes_in = (117 ('/service/$model/create', '/app/default/call/json/create?model=$model'),118)119'''120 load(data=data)121 self.assertEqual(filter_url('http://localhost:8000/service/person/create'), "/app/default/call ['json', 'create'] ?model=person")122 self.assertEqual(filter_url('http://localhost:8000/service/person/create?var1=val1'), "/app/default/call ['json', 'create'] ?model=person&var1=val1")123 def test_routes_specific(self):124 """125 Test app-specific routes.py126 Note that make_apptree above created applications/examples/routes.py with a default_function.127 """128 data = r'''129routes_app = [130 (r'/(?P<app>welcome|admin|examples)\b.*', r'\g<app>'),131 (r'$anything', r'welcome'),132 (r'/?$anything', r'welcome'),133]134'''135 load(data=data)136 self.assertEqual(137 filter_url('http://domain.com/welcome'), '/welcome/default/index')138 self.assertEqual(filter_url(139 'http://domain.com/examples'), '/examples/default/exdef')140 def test_routes_defapp(self):141 """ Test the default-application function """142 data = r'''143default_application = 'defapp'144'''145 load(data=data)146 # incoming147 self.assertEqual(148 filter_url('http://domain.com'), '/defapp/default/index')149 self.assertEqual(150 filter_url('http://domain.com/'), '/defapp/default/index')151 self.assertEqual(152 filter_url('http://domain.com/welcome'), '/welcome/default/index')153 self.assertEqual(154 filter_url('http://domain.com/app'), '/app/default/index')155 self.assertEqual(filter_url('http://domain.com/welcome/default/index/abc'), "/welcome/default/index ['abc']")156 self.assertEqual(filter_url('http://domain.com/welcome/static/abc'),157 norm_root('%s/applications/welcome/static/abc' % root))158 self.assertEqual(filter_url('http://domain.com/defapp/static/path/to/static'),159 norm_root("%s/applications/defapp/static/path/to/static" % root))160 def test_routes_raise(self):161 '''162 Test URLs that raise exceptions163 '''164 # test non-exception variants165 load(data='')166 self.assertEqual(167 filter_url('http://domain.com/init'), "/init/default/index")168 self.assertEqual(filter_url(169 'http://domain.com/init/default'), "/init/default/index")170 self.assertEqual(filter_url('http://domain.com/init/default/fcn.ext'),171 "/init/default/fcn.ext")172 self.assertEqual(filter_url('http://domain.com/init/default/fcn/arg'),173 "/init/default/fcn ['arg']")174 # now raise-HTTP variants175 self.assertRaises(HTTP, filter_url, 'http://domain.com/bad!ctl')176 self.assertRaises(HTTP, filter_url, 'http://domain.com/ctl/bad!fcn')177 self.assertRaises(178 HTTP, filter_url, 'http://domain.com/ctl/fcn.bad!ext')179 #self.assertRaises(180 # HTTP, filter_url, 'http://domain.com/ctl/fcn/bad!arg')181 #try:182 # # 2.7+ only183 # self.assertRaisesRegexp(HTTP, '400 BAD REQUEST \[invalid path\]', filter_url, 'http://domain.com/init/bad!ctl')184 # self.assertRaisesRegexp(HTTP, '400 BAD REQUEST \[invalid path\]', filter_url, 'http://domain.com/init/ctlr/bad!fcn')185 # self.assertRaisesRegexp(HTTP, '400 BAD REQUEST \[invalid path\]', filter_url, 'http://domain.com/init/ctlr/fcn.bad!ext')186 # self.assertRaisesRegexp(HTTP, '400 BAD REQUEST \[invalid path\]', filter_url, 'http://domain.com/appc/init/fcn/bad!arg')187 #except AttributeError:188 # pass189 self.assertEqual(filter_url('http://domain.com/welcome/default/fcn_1'),190 "/welcome/default/fcn_1")191 #self.assertRaises(HTTP, filter_url, 'http://domain.com/welcome/default/fcn-1')192 #try:193 # # 2.7+ only194 # self.assertRaisesRegexp(HTTP, '400 BAD REQUEST \[invalid path\]', filter_url, 'http://domain.com/welcome/default/fcn-1')195 #except AttributeError:196 # pass197 def test_routes_error(self):198 '''199 Test rewrite of HTTP errors200 '''201 router_err = dict()202 load(rdict=router_err)203 self.assertEqual(filter_err(200), 200)204 self.assertEqual(filter_err(399), 399)205 self.assertEqual(filter_err(400), 400)206 def test_routes_args(self):207 '''208 Test URL args parsing/generation209 '''210 data = r'''routes_in = [211 ('/robots.txt', '/welcome/static/robots.txt'),212 ('/favicon.ico', '/welcome/static/favicon.ico'),213 ('/admin$anything', '/admin$anything'),214 ('.*:https?://(.*\\.)?domain1.com:$method /', '/app1/default'),215 ('.*:https?://(.*\\.)?domain1.com:$method /static/$anything',216 '/app1/static/$anything'),217 ('.*:https?://(.*\\.)?domain1.com:$method /appadmin/$anything',218 '/app1/appadmin/$anything'),219 ('.*:https?://(.*\\.)?domain1.com:$method /$anything',220 '/app1/default/$anything'),221 ('.*:https?://(.*\\.)?domain2.com:$method /', '/app2/default'),222 ('.*:https?://(.*\\.)?domain2.com:$method /static/$anything',223 '/app2/static/$anything'),224 ('.*:https?://(.*\\.)?domain2.com:$method /appadmin/$anything',225 '/app2/appadmin/$anything'),226 ('.*:https?://(.*\\.)?domain2.com:$method /$anything',227 '/app2/default/$anything'),228 ('.*:https?://(.*\\.)?domain3.com:$method /', '/app3/defcon3'),229 ('.*:https?://(.*\\.)?domain3.com:$method /static/$anything',230 '/app3/static/$anything'),231 ('.*:https?://(.*\\.)?domain3.com:$method /appadmin/$anything',232 '/app3/appadmin/$anything'),233 ('.*:https?://(.*\\.)?domain3.com:$method /$anything',234 '/app3/defcon3/$anything'),235 ('/', '/welcome/default'),236 ('/welcome/default/$anything', '/welcome/default/$anything'),237 ('/welcome/$anything', '/welcome/default/$anything'),238 ('/static/$anything', '/welcome/static/$anything'),239 ('/appadmin/$anything', '/welcome/appadmin/$anything'),240 ('/$anything', '/welcome/default/$anything'),241 ]242routes_out = [243 ('/welcome/static/$anything', '/static/$anything'),244 ('/welcome/appadmin/$anything', '/appadmin/$anything'),245 ('/welcome/default/$anything', '/$anything'),246 ('/app1/static/$anything', '/static/$anything'),247 ('/app1/appadmin/$anything', '/appadmin/$anything'),248 ('/app1/default/$anything', '/$anything'),249 ('/app2/static/$anything', '/static/$anything'),250 ('/app2/appadmin/$anything', '/appadmin/$anything'),251 ('/app2/default/$anything', '/$anything'),252 ('/app3/static/$anything', '/static/$anything'),253 ('/app3/appadmin/$anything', '/appadmin/$anything'),254 ('/app3/defcon3/$anything', '/$anything')255 ]256'''257 load(data=data)258 self.assertEqual(259 filter_url('http://domain.com/welcome/default/f/arg1'),260 "/welcome/default/f ['arg1']")261 self.assertEqual(262 filter_url('http://domain.com/welcome/default/f/arg1/'),263 "/welcome/default/f ['arg1']")264 self.assertEqual(265 filter_url('http://domain.com/welcome/default/f/arg1//'),266 "/welcome/default/f ['arg1', '']")267 self.assertEqual(268 filter_url('http://domain.com/welcome/default/f//arg1'),269 "/welcome/default/f ['', 'arg1']")270 self.assertEqual(271 filter_url('http://domain.com/welcome/default/f/arg1/arg2'),272 "/welcome/default/f ['arg1', 'arg2']")273 self.assertEqual(274 filter_url('http://domain.com/welcome/default/f/arg1//arg2'),275 "/welcome/default/f ['arg1', '', 'arg2']")276 self.assertEqual(277 filter_url('http://domain.com/welcome/default/f/arg1//arg3/'),278 "/welcome/default/f ['arg1', '', 'arg3']")279 self.assertEqual(280 filter_url('http://domain.com/welcome/default/f/arg1//arg3//'),281 "/welcome/default/f ['arg1', '', 'arg3', '']")282 self.assertEqual(283 filter_url('http://domain.com/welcome/default/f', out=True), "/f")284 self.assertEqual(regex_filter_out('/welcome/default/f'), "/f")285 self.assertEqual(286 str(URL(a='welcome', c='default', f='f', args=None)), "/f")287 self.assertEqual(str(288 URL(a='welcome', c='default', f='f', args=['arg1'])), "/f/arg1")289 self.assertEqual(str(URL(290 a='welcome', c='default', f='f', args=['arg1', ''])), "/f/arg1//")291 self.assertEqual(str(URL(a='welcome', c='default', f='f',292 args=['arg1', '', 'arg3'])), "/f/arg1//arg3")293 self.assertEqual(str(294 URL(a='welcome', c='default', f='f', args=['ar g'])), "/f/ar%20g")295 self.assertEqual(str(URL(296 a='welcome', c='default', f='f', args=['årg'])), "/f/%C3%A5rg")297 self.assertEqual(298 str(URL(a='welcome', c='default', f='fünc')), "/f\xc3\xbcnc")299 def test_routes_anchor(self):300 '''301 Test URL with anchor302 '''303 self.assertEqual(304 str(URL(a='a', c='c', f='f', anchor='anchor')), "/a/c/f#anchor")305 load(data='')306 self.assertEqual(307 str(URL(a='a', c='c', f='f', anchor='anchor')), "/a/c/f#anchor")308 args = ['a1', 'a2']309 self.assertEqual(310 str(URL(a='a', c='c', f='f', args=args, anchor='anchor')),311 "/a/c/f/a1/a2#anchor")312 vars = dict(v1=1, v2=2)313 self.assertEqual(314 str(URL(a='a', c='c', f='f', vars=vars, anchor='anchor')),315 "/a/c/f?v1=1&v2=2#anchor")316 self.assertEqual(317 str(URL(318 a='a', c='c', f='f', args=args, vars=vars, anchor='anchor')),319 "/a/c/f/a1/a2?v1=1&v2=2#anchor")320 data = r'''routes_out = [321 ('/init/default/index', '/'),322 ]'''323 load(data=data)324 self.assertEqual(str(URL(a='init', c='default', f='index')),325 "/")326 self.assertEqual(327 str(URL(a='init', c='default', f='index', anchor='anchor')),328 "/init/default/index#anchor")329 data = r'''routes_out = [330 (r'/init/default/index(?P<anchor>(#.*)?)', r'/\g<anchor>'),331 ]'''332 load(data=data)333 self.assertEqual(str(URL(a='init', c='default', f='index')),334 "/")335 self.assertEqual(336 str(URL(a='init', c='default', f='index', anchor='anchor')),337 "/#anchor")338 data = r'''routes_out = [339 (r'/init/default/index(?P<qa>([?#].*)?)', r'/\g<qa>'),340 ]'''341 load(data=data)342 self.assertEqual(str(URL(a='init', c='default', f='index')),343 "/")344 self.assertEqual(345 str(URL(a='init', c='default', f='index', anchor='anchor')),346 "/#anchor")347 query = dict(var='abc')348 self.assertEqual(349 str(URL(a='init', c='default', f='index', vars=query)),350 "/?var=abc")351 self.assertEqual(352 str(URL(a='init', c='default', f='index',353 vars=query, anchor='anchor')),354 "/?var=abc#anchor")355 def test_routes_absolute(self):356 '''357 Test absolute URL358 '''359 load(data='')360 r = Storage()361 r.env = Storage()362 r.env.http_host = 'domain.com'363 r.env.wsgi_url_scheme = 'httpx' # distinguish incoming scheme364 self.assertEqual(str(URL(r=r, a='a', c='c', f='f')), "/a/c/f")365 self.assertEqual(str(URL(r=r, a='a', c='c', f='f', host=True)),366 "httpx://domain.com/a/c/f")367 self.assertEqual(str(URL(r=r, a='a', c='c', f='f', host='host.com')),368 "httpx://host.com/a/c/f")369 self.assertEqual(str(URL(r=r, a='a', c='c', f='f', scheme=True)),370 "httpx://domain.com/a/c/f")371 self.assertEqual(str(URL(r=r, a='a', c='c', f='f', scheme=False)),372 "/a/c/f")373 self.assertEqual(str(URL(r=r, a='a', c='c', f='f', scheme='https')),374 "https://domain.com/a/c/f")375 self.assertEqual(str(URL(r=r, a='a', c='c', f='f', scheme='wss')),376 "wss://domain.com/a/c/f")377 self.assertEqual(378 str(URL(r=r, a='a', c='c', f='f', scheme=True, host=True)),379 "httpx://domain.com/a/c/f")380 self.assertEqual(381 str(URL(r=r, a='a', c='c', f='f', scheme='https', host=True)),382 "https://domain.com/a/c/f")383 self.assertEqual(384 str(URL(r=r, a='a', c='c', f='f', scheme=False, host=True)),385 "httpx://domain.com/a/c/f")386 self.assertEqual(387 str(URL(r=r, a='a', c='c', f='f', scheme=True, host='host.com')),388 "httpx://host.com/a/c/f")389 self.assertEqual(390 str(URL(r=r, a='a', c='c', f='f', scheme=False, host='host.com')),391 "httpx://host.com/a/c/f")392 self.assertEqual(str(URL(r=r, a='a', c='c', f='f', port=1234)),393 "httpx://domain.com:1234/a/c/f")394 self.assertEqual(395 str(URL(r=r, a='a', c='c', f='f', scheme=True, port=1234)),396 "httpx://domain.com:1234/a/c/f")397 self.assertEqual(398 str(URL(r=r, a='a', c='c', f='f', host='host.com', port=1234)),399 "httpx://host.com:1234/a/c/f")400 self.assertEqual(401 str(URL(r=r, a='a', c='c', f='f', scheme='wss',402 host='host.com', port=1234)),403 "wss://host.com:1234/a/c/f")404 def test_request_uri(self):405 '''406 Test REQUEST_URI in env407 '''408 data = r'''routes_in = [409 ('/abc', '/init/default/abc'),410 ('/index/$anything', '/init/default/index/$anything'),411 ]412'''413 load(data=data)414 self.assertEqual(415 filter_url('http://domain.com/abc', env=True).request_uri,416 '/init/default/abc')417 self.assertEqual(418 filter_url('http://domain.com/abc?def', env=True).request_uri,419 '/init/default/abc?def')420 self.assertEqual(421 filter_url('http://domain.com/index/abc', env=True).request_uri,422 "/init/default/index/abc")423 self.assertEqual(424 filter_url('http://domain.com/index/a%20bc', env=True).request_uri,425 "/init/default/index/a bc")426if __name__ == '__main__':427 setUpModule() # pre-2.7428 unittest.main()...

Full Screen

Full Screen

check_attrs.py

Source:check_attrs.py Github

copy

Full Screen

...11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.12# See the License for the specific language governing permissions and13# limitations under the License.14"""Buildgen attribute validation plugin."""15def anything():16 return lambda v: None17def one_of(values):18 return lambda v: ('{0} is not in [{1}]'.format(v, values)19 if v not in values else None)20def subset_of(values):21 return lambda v: ('{0} is not subset of [{1}]'.format(v, values)22 if not all(e in values for e in v) else None)23VALID_ATTRIBUTE_KEYS_MAP = {24 'filegroup': {25 'deps': anything(),26 'headers': anything(),27 'plugin': anything(),28 'public_headers': anything(),29 'src': anything(),30 'uses': anything(),31 },32 'lib': {33 'baselib': anything(),34 'boringssl': one_of((True,)),35 'build_system': anything(),36 'build': anything(),37 'cmake_target': anything(),38 'defaults': anything(),39 'deps_linkage': one_of(('static',)),40 'deps': anything(),41 'dll': one_of((True, 'only')),42 'filegroups': anything(),43 'generate_plugin_registry': anything(),44 'headers': anything(),45 'language': one_of(('c', 'c++', 'csharp')),46 'LDFLAGS': anything(),47 'platforms': subset_of(('linux', 'mac', 'posix', 'windows')),48 'public_headers': anything(),49 'secure': one_of(('check', True, False)),50 'src': anything(),51 'vs_proj_dir': anything(),52 'zlib': one_of((True,)),53 },54 'target': {55 'args': anything(),56 'benchmark': anything(),57 'boringssl': one_of((True,)),58 'build': anything(),59 'ci_platforms': anything(),60 'corpus_dirs': anything(),61 'cpu_cost': anything(),62 'defaults': anything(),63 'deps': anything(),64 'dict': anything(),65 'exclude_configs': anything(),66 'exclude_iomgrs': anything(),67 'excluded_poll_engines': anything(),68 'filegroups': anything(),69 'flaky': one_of((True, False)),70 'gtest': one_of((True, False)),71 'headers': anything(),72 'language': one_of(('c', 'c89', 'c++', 'csharp')),73 'maxlen': anything(),74 'platforms': subset_of(('linux', 'mac', 'posix', 'windows')),75 'run': one_of((True, False)),76 'secure': one_of(('check', True, False)),77 'src': anything(),78 'timeout_seconds': anything(),79 'uses_polling': anything(),80 'vs_proj_dir': anything(),81 'zlib': one_of((True,)),82 },83}84def check_attributes(entity, kind, errors):85 attributes = VALID_ATTRIBUTE_KEYS_MAP[kind]86 name = entity.get('name', anything())87 for key, value in entity.items():88 if key == 'name':89 continue90 validator = attributes.get(key)91 if validator:92 error = validator(value)93 if error:94 errors.append(95 "{0}({1}) has an invalid value for '{2}': {3}".format(96 name, kind, key, error))97 else:98 errors.append("{0}({1}) has an invalid attribute '{2}'".format(99 name, kind, key))100def mako_plugin(dictionary):...

Full Screen

Full Screen

scroll.js

Source:scroll.js Github

copy

Full Screen

1/**2 * @author CaMnter3 */4import { createElement, Component } from 'rax';5import ScrollView from 'rax-scrollview';6import Text from 'rax-text';7class ScrollViewComponent extends Component {8 constructor(props) {9 super(props);10 this.state = {};11 }12 render() {13 return (14 <ScrollView loadMoreOffset={300} onLoadMore={() => {15 console.log('onLoadMore');16 }}>17 <Text style={{ color: '#ffffff', margin: 5, fontSize: 12, backgroundColor: 'blue' }}>18 Save you from anything19 Save you from anything20 Save you from anything21 Save you from anything22 Save you from anything23 Save you from anything24 Save you from anything25 Save you from anything26 Save you from anything27 Save you from anything28 Save you from anything29 Save you from anything30 Save you from anything31 Save you from anything32 Save you from anything33 Save you from anything34 Save you from anything35 Save you from anything36 Save you from anything37 Save you from anything38 Save you from anything39 Save you from anything40 Save you from anything41 Save you from anything42 Save you from anything43 Save you from anything44 Save you from anything45 Save you from anything46 Save you from anything47 Save you from anything48 Save you from anything49 Save you from anything50 Save you from anything51 Save you from anything52 Save you from anything53 Save you from anything54 Save you from anything55 Save you from anything56 Save you from anything57 Save you from anything58 Save you from anything59 Save you from anything60 Save you from anything61 Save you from anything62 Save you from anything63 Save you from anything64 Save you from anything65 Save you from anything66 Save you from anything67 Save you from anything68 Save you from anything69 Save you from anything70 Save you from anything71 Save you from anything72 Save you from anything73 Save you from anything74 Save you from anything75 Save you from anything76 Save you from anything77 Save you from anything78 Save you from anything79 Save you from anything80 Save you from anything81 Save you from anything82 Save you from anything83 Save you from anything84 Save you from anything85 Save you from anything86 Save you from anything87 Save you from anything88 Save you from anything89 Save you from anything90 Save you from anything91 Save you from anything92 Save you from anything93 Save you from anything94 Save you from anything95 Save you from anything96 Save you from anything97 Save you from anything98 Save you from anything99 Save you from anything100 Save you from anything101 Save you from anything102 Save you from anything103 Save you from anything104 Save you from anything105 Save you from anything106 Save you from anything107 Save you from anything108 Save you from anything109 </Text>110 </ScrollView>111 );112 }113}...

Full Screen

Full Screen

text.js

Source:text.js Github

copy

Full Screen

1/**2 * @author CaMnter3 */4import { createElement, render, Component } from 'rax';5import View from 'rax-view';6import Text from 'rax-text';7class TextComponent extends Component {8 constructor(props) {9 super(props);10 this.state = {};11 }12 render() {13 return (14 <View style={{ width: 750, paddingTop: 20 }}>15 <View style={{16 ...styles.container, ...{17 flexDirection: 'row',18 justifyContent: 'flex-start'19 }20 }}>21 <Text style={styles.text}>Save you </Text>22 <Text style={{ ...styles.text, color: '#ff4200' }}>from anything</Text>23 </View>24 <View style={styles.container}>25 <Text numberOfLines={1} style={{26 ...styles.text,27 width: 300,28 textOverflow: 'ellipsis'29 }}>Save you from anything</Text>30 <Text numberOfLines={2} style={{31 ...styles.text,32 width: 300,33 textOverflow: 'ellipsis'34 }}>Save you from anything Save you from anything Save you from anything Save you from35 anything Save you from anything Save you from anything Save you from anything Save you36 from anything Save you from anything</Text>37 </View>38 <View style={styles.container}>39 <Text style={{ ...styles.text, textDecoration: 'underline' }}>40 Save you from anything41 </Text>42 <Text style={{ ...styles.text, textDecorationLine: 'none' }}>43 Save you from anything44 </Text>45 <Text style={{ ...styles.text, textDecoration: 'line-through' }}>46 Save you from anything47 </Text>48 </View>49 <View style={styles.container}>50 <Text style={{ ...styles.text, lineHeight: '120rem' }}>51 Save you from anything Save you from anything Save you from anything Save you from52 anything Save you from anything Save you from anything Save you from anything Save you53 from anything Save you from anything Save you from anything Save you from anything Save54 you from anything Save you from55 anything Save you from anything Save you from anything Save you from anything Save you56 from anything Save you from anything Save you from anything Save you from anything Save57 you from anything Save you from58 anything Save you from anything Save you from anything Save you from anything Save you59 from anything Save you from anything60 </Text>61 </View>62 </View>63 );64 }65}66let styles = {67 container: {68 padding: 20,69 borderStyle: 'solid',70 borderColor: '#dddddd',71 borderWidth: 1,72 marginLeft: 20,73 marginRight: 20,74 fontSize: 16,75 marginBottom: 1076 },77 text: {78 fontSize: 16,79 color: 'steelblue'80 }81};...

Full Screen

Full Screen

decoratormatcher.js

Source:decoratormatcher.js Github

copy

Full Screen

...46 * Returns a matcher that matches anything.47 *48 * @return {!goog.labs.testing.AnythingMatcher} A AnythingMatcher.49 */50function anything() {51 return new goog.labs.testing.AnythingMatcher();52}53/**54 * Returnes any matcher that is passed to it (aids readability).55 *56 * @param {!goog.labs.testing.Matcher} matcher A matcher.57 * @return {!goog.labs.testing.Matcher} The wrapped matcher.58 */59function is(matcher) {60 return matcher;61}62/**63 * Returns a matcher with a customized description for the given matcher.64 *...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const anything = require('stryker-parent').anything;2const anything = require('stryker-parent').anything;3const anything = require('stryker-parent').anything;4const anything = require('stryker-parent').anything;5const anything = require('stryker-parent').anything;6const anything = require('stryker-parent').anything;7const anything = require('stryker-parent').anything;8const anything = require('stryker-parent').anything;9const anything = require('stryker-parent').anything;10const anything = require('stryker-parent').anything;11const anything = require('stryker-parent').anything;12const anything = require('stryker-parent').anything;13const anything = require('stryker-parent').anything;14const anything = require('stryker-parent').anything;15const anything = require('stryker-parent').anything;16const anything = require('stryker-parent').anything;17const anything = require('stryker-parent').anything;18const anything = require('stryker-parent').anything;19const anything = require('stryker-parent').anything;20const anything = require('stryker-parent').anything;

Full Screen

Using AI Code Generation

copy

Full Screen

1var anything = require('stryker-parent').anything;2anything();3var anything = require('stryker-parent').anything;4anything();5var anything = require('stryker-parent').anything;6anything();7var anything = require('stryker-parent').anything;8anything();9var anything = require('stryker-parent').anything;10anything();11var anything = require('stryker-parent').anything;12anything();13var anything = require('stryker-parent').anything;14anything();15var anything = require('stryker-parent').anything;16anything();17var anything = require('stryker-parent').anything;18anything();19var anything = require('stryker-parent').anything;20anything();21var anything = require('stryker-parent').anything;22anything();23var anything = require('stryker-parent').anything;24anything();25var anything = require('stryker-parent').anything;26anything();27var anything = require('stryker-parent').anything;28anything();29var anything = require('stryker-parent').anything;30anything();31var anything = require('stryker-parent').anything;32anything();

Full Screen

Using AI Code Generation

copy

Full Screen

1const anything = require('stryker-parent').anything;2describe('test', () => {3 it('should be able to use anything', () => {4 anything();5 });6});7module.exports = function(config) {8 config.set({9 });10};11module.exports = function(config) {12 config.set({13 });14};

Full Screen

Using AI Code Generation

copy

Full Screen

1var anything = require('stryker-parent').anything;2var something = anything();3var anything = require('stryker-parent').anything;4var something = anything();5{6 "dependencies": {7 }8}9{10 "dependencies": {11 }12}13{14 "dependencies": {15 }16}17{18 "dependencies": {19 }20}21{22 "dependencies": {23 }24}25{26 "dependencies": {27 }28}29{30 "dependencies": {31 }32}

Full Screen

Using AI Code Generation

copy

Full Screen

1const {anything} = require('stryker-parent/stryker/src/utils/objectUtils');2const {anything} = require('stryker-parent/stryker/src/utils/objectUtils');3const {anything} = require('stryker-parent/stryker/src/utils/objectUtils');4const {anything} = require('stryker-parent/stryker/src/utils/objectUtils');5const {anything} = require('stryker-parent/stryker/src/utils/objectUtils');6const {anything} = require('stryker-parent/stryker/src/utils/objectUtils');7const {anything} = require('stryker-parent/stryker/src/utils/objectUtils');

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 stryker-parent 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