How to use exclude method in mountebank

Best JavaScript code snippet using mountebank

upgrader.py

Source:upgrader.py Github

copy

Full Screen

1import os23#4#5#6from _domain.utils import read_json_array, read_json_object78#9#10#11from squid.models import *1213#14#15#16def load_array(conf_file):17 result = []18 with open(conf_file) as fin:19 for line in fin.readlines():20 pos = line.find('#')21 if pos != -1:22 line = line[:pos]23 line = line.strip()2425 if len(line) > 0:26 result.append(line)2728 return result2930#31#32#33def load_payload(conf_file):3435 # read all lines into memory36 lines = []37 with open(conf_file) as f:38 lines = f.readlines()3940 # throw away any non generated lines41 content = []42 found = False43 seen = False4445 for line in lines:4647 if not found:48 if line.find("-----BEGIN GENERATED CONFIGURATION-----") != -1:49 found = True50 seen = True51 else:52 if line.find("-----END GENERATED CONFIGURATION-----") != -1:53 found = False54 else:55 content.append(line.strip())5657 # and return nicely58 return content596061626364#65#66#67def load_annotated_array(conf_file):6869 # read all lines into memory70 lines = []71 with open(conf_file) as f:72 lines = f.readlines()7374 # throw away any non generated lines75 content = []76 found = False77 seen = False7879 for line in lines:8081 if not found:82 if line.find("-----BEGIN GENERATED CONFIGURATION-----") != -1:83 found = True84 seen = True85 else:86 if line.find("-----END GENERATED CONFIGURATION-----") != -1:87 found = False88 else:89 content.append(line.strip())9091 # this is the result to be returned92 result = []9394 # see if have at least seen our generated config95 if not seen:9697 # ok this must be old style generated config, so just load valid lines skipping comments98 for line in load_array(conf_file):99 if len(line) > 0:100 result.append( (line, "") )101102 return result103104 # if we got here we have nice lines in content to be imported105 comment = ""106 value = ""107 108 while len(content) > 0:109 item = content.pop(0).strip()110 if item.startswith("#"):111 comment += item.lstrip('#').rstrip('\r\n').strip()112 comment += "\n"113 else:114 value = item115116 if len(value) > 0:117 result.append( (value, comment) )118119 comment = ""120 value = ""121122 # and return nicely123 return result124125126#127# special storage for 3.1 and 3.2 types of configuration128#129class Storage:130131 def __init__(self, lines):132133 self.values = []134 for line in lines:135 try:136 n,v = line.split('=')137 n = n.strip()138 v = v.strip()139 if len(n) > 0:140 self.values.append( (n, v) )141 except:142 pass143144 def get_string(self, name):145 for (n,v) in self.values:146 if n.lower() == name.lower():147 return v148 return ""149150 def get_int(self, name):151 v = self.get_string(name)152 if v == "":153 return 0154 return int(v)155156 def get_bool(self, name):157 v = self.get_string(name).lower() 158 if v == "yes" or v == "on" or v == "true":159 return True160 return False161162 def get_list(self, name):163 r = []164 for (n,v) in self.values:165 if n.lower() == name.lower():166 r.append(v)167 return r168169#170#171#172class ConfFileReader:173174 def __init__(self, path):175 self.path = path176177 def read_lines(self, skip_comments):178 lines = self.read_contents(self.path)179 if not skip_comments:180 return lines181182 return self.remove_comments(lines)183184 def read_contents(self, path):185 with open(self.path) as fin:186 return fin.read().splitlines()187188 def remove_comments(self, lines):189 result = []190 for line in lines: 191 pos = line.find('#')192 if pos != -1:193 line = line[0:pos]194 line = line.strip()195 if len(line) > 0:196 result.append(line)197 return result198199#200#201#202class SquidImporter:203204 def upgrade(self, version, folder):205206 #self.upgrade_wsicapd(version, folder)207 self.upgrade_icap(folder)208 self.upgrade_ssl(folder)209 self.upgrade_auth(folder)210 self.upgrade_auth_schemes(version, folder)211 self.upgrade_cache(folder)212 self.upgrade_urlrewrite(folder)213214 def upgrade_icap(self, folder):215216 # upgrade advanced first217 if True:218219 advanced_path = os.path.join(folder, 'adaptation/exclude/advanced.conf')220 if not os.path.isfile(advanced_path):221 advanced_path = os.path.join(folder, 'icap_exclude_advanced.conf')222223 if os.path.isfile(advanced_path):224225 advanced_data = load_payload(advanced_path)226 advanced_obj = ExcludeAdvanced.objects.first()227 advanced_obj.value_adaptation = "\n".join(advanced_data)228 advanced_obj.save()229 230 # names to set map231 for name, s in {232233 'icap_exclude_content_type.conf' : ExcludeContentType.objects,234 'adaptation/exclude/content_type.conf' : ExcludeContentType.objects,235236 'icap_exclude_domain_ip4.conf' : ExcludeDomainIp.objects,237 'icap_exclude_domain_ip6.conf' : ExcludeDomainIp.objects,238 'adaptation/exclude/domain_ip.conf' : ExcludeDomainIp.objects,239240 'icap_exclude_domain_name.conf' : ExcludeDomainName.objects,241 'adaptation/exclude/domain_name.conf' : ExcludeDomainName.objects,242243 'icap_exclude_domain_range4.conf' : ExcludeDomainRange.objects,244 'icap_exclude_domain_range6.conf' : ExcludeDomainRange.objects,245 'adaptation/exclude/domain_range.conf' : ExcludeDomainRange.objects,246247 'icap_exclude_domain_subnet4.conf' : ExcludeDomainSubnet.objects,248 'icap_exclude_domain_subnet6.conf' : ExcludeDomainSubnet.objects,249 'adaptation/exclude/domain_subnet.conf' : ExcludeDomainSubnet.objects,250251 'icap_exclude_schedule.conf' : ExcludeSchedule.objects,252 'adaptation/exclude/schedule.conf' : ExcludeSchedule.objects,253254 'icap_exclude_user_agent.conf' : ExcludeUserAgent.objects,255 'adaptation/exclude/user_agent.conf' : ExcludeUserAgent.objects,256257 'icap_exclude_user_ip4.conf' : ExcludeUserIp.objects,258 'icap_exclude_user_ip6.conf' : ExcludeUserIp.objects,259 'adaptation/exclude/user_ip.conf' : ExcludeUserIp.objects,260261 'icap_exclude_user_name.conf' : ExcludeUserName.objects,262263 'icap_exclude_user_range4.conf' : ExcludeUserRange.objects,264 'icap_exclude_user_range6.conf' : ExcludeUserRange.objects,265 'adaptation/exclude/user_range.conf' : ExcludeUserRange.objects,266267 'icap_exclude_user_subnet4.conf' : ExcludeUserSubnet.objects,268 'icap_exclude_user_subnet6.conf' : ExcludeUserSubnet.objects,269 'adaptation/exclude/user_subnet.conf' : ExcludeUserSubnet.objects270 }.iteritems():271272 # load file contents as array273 path1 = os.path.join(folder, name)274 if os.path.exists(path1):275 for (value, comment) in load_annotated_array(path1):276 try:277 v, c = s.get_or_create(value=value)278 v.comment = comment279 v.bypass_adaptation = True280 v.save()281 except Exception as e:282 # logging.warning("Ignoring import of %s, error '%s' ..." % (value, str(e)))283 pass284285 def upgrade_cache(self, folder):286287 # upgrade advanced first288 if True:289290 advanced_path = os.path.join(folder, 'cache/exclude/advanced.conf') 291 if os.path.isfile(advanced_path):292293 advanced_data = load_payload(advanced_path)294 advanced_obj = ExcludeAdvanced.objects.first()295 advanced_obj.value_cache = "\n".join(advanced_data)296 advanced_obj.save()297 298 # names to set map299 for name, s in {300301 'cache/exclude/content_type.conf' : ExcludeContentType.objects,302 'cache/exclude/domain_ip.conf' : ExcludeDomainIp.objects,303 'cache/exclude/domain_name.conf' : ExcludeDomainName.objects,304 'cache/exclude/domain_range.conf' : ExcludeDomainRange.objects,305 'cache/exclude/domain_subnet.conf' : ExcludeDomainSubnet.objects,306 'cache/exclude/schedule.conf' : ExcludeSchedule.objects,307 'cache/exclude/user_agent.conf' : ExcludeUserAgent.objects,308 'cache/exclude/user_ip.conf' : ExcludeUserIp.objects,309 'cache/exclude/user_name.conf' : ExcludeUserName.objects,310 'cache/exclude/user_range.conf' : ExcludeUserRange.objects,311 'cache/exclude/user_subnet.conf' : ExcludeUserSubnet.objects312 }.iteritems():313314 # load file contents as array315 path1 = os.path.join(folder, name)316 if os.path.exists(path1):317 for (value, comment) in load_annotated_array(path1):318 try:319 v, c = s.get_or_create(value=value)320 v.bypass_cache = True321 v.comment = comment322 v.save()323 except Exception as e:324 # logging.warning("Ignoring import of %s, error '%s' ..." % (value, str(e)))325 pass326327 def upgrade_urlrewrite(self, folder):328329 # upgrade advanced first330 if True:331332 advanced_path = os.path.join(folder, 'urlrewrite/exclude/advanced.conf')333 if os.path.isfile(advanced_path):334 advanced_data = load_payload(advanced_path)335 advanced_obj = ExcludeAdvanced.objects.first()336 advanced_obj.value_urlrewrite = "\n".join(advanced_data)337 advanced_obj.save()338339 # names to set map340 for name, s in {341342 'urlrewrite/exclude/domain_ip.conf': ExcludeDomainIp.objects,343 'urlrewrite/exclude/domain_name.conf': ExcludeDomainName.objects,344 'urlrewrite/exclude/domain_range.conf': ExcludeDomainRange.objects,345 'urlrewrite/exclude/domain_subnet.conf': ExcludeDomainSubnet.objects,346 'urlrewrite/exclude/schedule.conf': ExcludeSchedule.objects,347 'urlrewrite/exclude/user_agent.conf': ExcludeUserAgent.objects,348 'urlrewrite/exclude/user_ip.conf': ExcludeUserIp.objects,349 'urlrewrite/exclude/user_name.conf': ExcludeUserName.objects,350 'urlrewrite/exclude/user_range.conf': ExcludeUserRange.objects,351 'urlrewrite/exclude/user_subnet.conf': ExcludeUserSubnet.objects352 }.iteritems():353354 # load file contents as array355 path1 = os.path.join(folder, name)356 if os.path.exists(path1):357 for (value, comment) in load_annotated_array(path1):358 try:359 v, c = s.get_or_create(value=value)360 v.bypass_urlrewrite = True361 v.comment = comment362 v.save()363 except Exception as e:364 # logging.warning("Ignoring import of %s, error '%s' ..." % (value, str(e)))365 pass366367 def upgrade_ssl(self, folder):368369 # upgrade advanced first370 if True:371372 advanced_path = os.path.join(folder, 'ssl/exclude/advanced.conf')373 if os.path.isfile(advanced_path):374375 advanced_data = load_payload(advanced_path)376 advanced_obj = ExcludeAdvanced.objects.first()377 advanced_obj.value_ssbump = "\n".join(advanced_data)378 advanced_obj.save()379380 # upgrade NON bumped categories381 if True:382383 path = os.path.join(os.path.dirname(folder), "safety", "non_bumped_categories.json")384 if os.path.exists(path):385386 obj = ExcludeCategories.objects.first()387 entries = read_json_array(path)388 for entry in entries:389390 attrname = "exclude_%s" % entry391 setattr(obj, attrname, True)392393 obj.save()394395 # upgrade ssl exclusions396 for name, s in {397 'https_exclusions.conf': ExcludeDomainName.objects,398 'ssl_exclude_domains.conf': ExcludeDomainName.objects,399 'ssl/exclude/domains.conf': ExcludeDomainName.objects,400 'ssl_exclude_ips.conf': ExcludeDomainIp.objects,401 'ssl/exclude/ips.conf': ExcludeDomainIp.objects,402 'ssl_exclude_subnets.conf': ExcludeDomainSubnet.objects,403 'ssl/exclude/subnets.conf': ExcludeDomainSubnet.objects,404 }.iteritems():405406 # load file contents as array407 path1 = os.path.join(folder, name)408 if os.path.exists(path1):409 for (value, comment) in load_annotated_array(path1):410 try:411 v, c = s.get_or_create(value=value)412 v.bypass_sslbump = True413 v.comment = comment414 v.save()415 except Exception as e:416 # logging.warning("Ignoring import of %s, error '%s' ..." % (value, str(e)))417 pass418419 # name to set map420 for name, s in {421 'https_targets.conf' : SslTargetDomain.objects,422 'ssl_target_domains.conf' : SslTargetDomain.objects,423 'ssl/target/domains.conf' : SslTargetDomain.objects,424 'ssl_target_ips.conf' : SslTargetIp.objects,425 'ssl/target/ips.conf' : SslTargetIp.objects,426 'ssl_target_subnets.conf' : SslTargetSubnet.objects,427 'ssl/target/subnets.conf' : SslTargetSubnet.objects,428 'ssl_error_domains.conf' : SslErrorDomain.objects,429 'ssl/error/domains.conf' : SslErrorDomain.objects,430 'ssl_error_ips.conf' : SslErrorIp.objects,431 'ssl/error/ips.conf' : SslErrorIp.objects,432 'ssl_error_subnets.conf' : SslErrorSubnet.objects,433 'ssl/error/subnets.conf' : SslErrorSubnet.objects434435 }.iteritems():436437 # load file contents as array438 path1 = os.path.join(folder, name)439 if os.path.exists(path1):440 for (value, comment) in load_annotated_array(path1):441 try:442 v, c = s.get_or_create(value=value)443 v.comment = comment444 v.save()445 except Exception as e:446 # logging.warning("Ignoring import of %s, error '%s' ..." % (value, str(e)))447 pass448449 # we cannot automatically enable bump mode, admin needs to do it explicitly450451452 def upgrade_auth(self, folder):453454 # upgrade advanced first455 if True:456457 advanced_path = os.path.join(folder, 'authentication/exclude/advanced.conf')458 if not os.path.isfile(advanced_path):459 advanced_path = os.path.join(folder, 'auth_exclude_advanced.conf')460461 if os.path.isfile(advanced_path):462463 advanced_data = load_payload(advanced_path)464 advanced_obj = ExcludeAdvanced.objects.first()465 advanced_obj.value_auth = "\n".join(advanced_data)466 advanced_obj.save()467468 # name to set map469 for name, s in {470 471 'auth_exclude_domain_ip4.conf' : ExcludeDomainIp.objects,472 'auth_exclude_domain_ip6.conf' : ExcludeDomainIp.objects,473 'authentication/exclude/domain_ip.conf' : ExcludeDomainIp.objects,474 'auth_exclude_domain_name.conf' : ExcludeDomainName.objects,475 'authentication/exclude/domain_name.conf' : ExcludeDomainName.objects,476 'auth_exclude_domain_range4.conf' : ExcludeDomainRange.objects,477 'auth_exclude_domain_range6.conf' : ExcludeDomainRange.objects,478 'authentication/exclude/domain_range.conf' : ExcludeDomainRange.objects,479 'auth_exclude_domain_subnet4.conf' : ExcludeDomainSubnet.objects,480 'auth_exclude_domain_subnet6.conf' : ExcludeDomainSubnet.objects,481 'authentication/exclude/domain_subnet.conf' : ExcludeDomainSubnet.objects,482 'auth_exclude_schedule.conf' : ExcludeSchedule.objects,483 'authentication/exclude/schedule.conf' : ExcludeSchedule.objects,484 'auth_exclude_user_agent.conf' : ExcludeUserAgent.objects,485 'authentication/exclude/user_agent.conf' : ExcludeUserAgent.objects,486 'auth_exclude_user_ip4.conf' : ExcludeUserIp.objects,487 'auth_exclude_user_ip6.conf' : ExcludeUserIp.objects,488 'authentication/exclude/user_ip.conf' : ExcludeUserIp.objects,489 'auth_exclude_user_range4.conf' : ExcludeUserRange.objects,490 'auth_exclude_user_range6.conf' : ExcludeUserRange.objects,491 'authentication/exclude/user_range.conf' : ExcludeUserRange.objects,492 'auth_exclude_user_subnet4.conf' : ExcludeUserSubnet.objects,493 'auth_exclude_user_subnet6.conf' : ExcludeUserSubnet.objects,494 'authentication/exclude/user_subnet.conf' : ExcludeUserSubnet.objects495 }.iteritems():496497 # load file contents as array498 path1 = os.path.join(folder, name)499 if os.path.exists(path1):500 for (value, comment) in load_annotated_array(path1):501 try:502 v, c = s.get_or_create(value=value)503 v.bypass_auth = True504 v.comment = comment505 v.save()506 except Exception as e:507 # logging.warning("Ignoring import of %s, error '%s' ..." % (value, str(e)))508 pass509510 def upgrade_auth_schemes(self, version, folder):511512 file = os.path.join(folder, "auth_labels.json")513 if not os.path.isfile(file):514 return515516 data = read_json_object(file)517518 # save labelling519 obj = AuthLabel.objects.first()520 obj.enable = data['enable']521 obj.resolve_ip_as_user_name = data['resolve_ip_as_user_name'] 522 obj.save()523524 # save labels525 for label in data["labels"]:526527 if not label["user_name"]:528 continue529530 try:531 v, c = AuthLabelUsers.objects.get_or_create(user_name=label["user_name"])532 v.user_ip = label["user_ip"]533 v.user_mac = label["user_eui"]534 v.comment = label["comment"]535 536 v.save()537 except Exception as e:538 #logging.warning("Ignoring import of user name label %s, error '%s' ..." % (label["user_name"], str(e)))539 pass540541#542#543#544class Upgrader(object):545546 def __init__(self, major, minor):547548 self.major = major549 self.minor = minor550551 def upgrade(self, etc_dir):552 ...

Full Screen

Full Screen

test_selection_expansion.py

Source:test_selection_expansion.py Github

copy

Full Screen

1from test.integration.base import DBTIntegrationTest, FakeArgs, use_profile2import yaml3from dbt.task.test import TestTask4from dbt.task.list import ListTask5class TestSelectionExpansion(DBTIntegrationTest):6 @property7 def schema(self):8 return "test_selection_expansion_066"9 @property10 def models(self):11 return "models"12 @property13 def project_config(self):14 return {15 "config-version": 2,16 "test-paths": ["tests"]17 }18 def list_tests_and_assert(self, include, exclude, expected_tests, indirect_selection='eager', selector_name=None):19 list_args = [ 'ls', '--resource-type', 'test']20 if include:21 list_args.extend(('--select', include))22 if exclude:23 list_args.extend(('--exclude', exclude))24 if indirect_selection:25 list_args.extend(('--indirect-selection', indirect_selection))26 if selector_name:27 list_args.extend(('--selector', selector_name))28 listed = self.run_dbt(list_args)29 assert len(listed) == len(expected_tests)30 test_names = [name.split('.')[-1] for name in listed]31 assert sorted(test_names) == sorted(expected_tests)32 def run_tests_and_assert(self, include, exclude, expected_tests, indirect_selection='eager', selector_name=None):33 results = self.run_dbt(['run'])34 self.assertEqual(len(results), 2)35 test_args = ['test']36 if include:37 test_args.extend(('--models', include))38 if exclude:39 test_args.extend(('--exclude', exclude))40 if indirect_selection:41 test_args.extend(('--indirect-selection', indirect_selection))42 if selector_name:43 test_args.extend(('--selector', selector_name))44 results = self.run_dbt(test_args)45 tests_run = [r.node.name for r in results]46 assert len(tests_run) == len(expected_tests)47 assert sorted(tests_run) == sorted(expected_tests)48 @use_profile('postgres')49 def test__postgres__all_tests_no_specifiers(self):50 select = None51 exclude = None52 expected = [53 'cf_a_b', 'cf_a_src', 'just_a',54 'relationships_model_a_fun__fun__ref_model_b_',55 'relationships_model_a_fun__fun__source_my_src_my_tbl_',56 'source_unique_my_src_my_tbl_fun',57 'unique_model_a_fun'58 ]59 self.list_tests_and_assert(select, exclude, expected)60 self.run_tests_and_assert(select, exclude, expected)61 @use_profile('postgres')62 def test__postgres__model_a_alone(self):63 select = 'model_a'64 exclude = None65 expected = [66 'cf_a_b', 'cf_a_src', 'just_a',67 'relationships_model_a_fun__fun__ref_model_b_',68 'relationships_model_a_fun__fun__source_my_src_my_tbl_',69 'unique_model_a_fun'70 ]71 self.list_tests_and_assert(select, exclude, expected)72 self.run_tests_and_assert(select, exclude, expected)73 @use_profile('postgres')74 def test__postgres__model_a_model_b(self):75 select = 'model_a model_b'76 exclude = None77 expected = [78 'cf_a_b','cf_a_src','just_a','unique_model_a_fun',79 'relationships_model_a_fun__fun__ref_model_b_',80 'relationships_model_a_fun__fun__source_my_src_my_tbl_'81 ]82 self.list_tests_and_assert(select, exclude, expected)83 self.run_tests_and_assert(select, exclude, expected)84 @use_profile('postgres')85 def test__postgres__model_a_sources(self):86 select = 'model_a source:*'87 exclude = None88 expected = [89 'cf_a_b','cf_a_src','just_a','unique_model_a_fun',90 'source_unique_my_src_my_tbl_fun',91 'relationships_model_a_fun__fun__ref_model_b_',92 'relationships_model_a_fun__fun__source_my_src_my_tbl_'93 ]94 self.list_tests_and_assert(select, exclude, expected)95 self.run_tests_and_assert(select, exclude, expected)96 @use_profile('postgres')97 def test__postgres__exclude_model_b(self):98 select = None99 exclude = 'model_b'100 expected = [101 'cf_a_src', 'just_a',102 'relationships_model_a_fun__fun__source_my_src_my_tbl_',103 'source_unique_my_src_my_tbl_fun','unique_model_a_fun'104 ]105 self.list_tests_and_assert(select, exclude, expected)106 self.run_tests_and_assert(select, exclude, expected)107 @use_profile('postgres')108 def test__postgres__model_a_exclude_specific_test(self):109 select = 'model_a'110 exclude = 'unique_model_a_fun'111 expected = [112 'cf_a_b','cf_a_src','just_a',113 'relationships_model_a_fun__fun__ref_model_b_',114 'relationships_model_a_fun__fun__source_my_src_my_tbl_'115 ]116 self.list_tests_and_assert(select, exclude, expected)117 self.run_tests_and_assert(select, exclude, expected)118 @use_profile('postgres')119 def test__postgres__model_a_exclude_specific_test_cautious(self):120 select = 'model_a'121 exclude = 'unique_model_a_fun'122 expected = ['just_a']123 indirect_selection = 'cautious'124 self.list_tests_and_assert(select, exclude, expected, indirect_selection)125 self.run_tests_and_assert(select, exclude, expected, indirect_selection)126 @use_profile('postgres')127 def test__postgres__only_generic(self):128 select = 'test_type:generic'129 exclude = None130 expected = [131 'relationships_model_a_fun__fun__ref_model_b_',132 'relationships_model_a_fun__fun__source_my_src_my_tbl_',133 'source_unique_my_src_my_tbl_fun',134 'unique_model_a_fun'135 ]136 self.list_tests_and_assert(select, exclude, expected)137 self.run_tests_and_assert(select, exclude, expected)138 @use_profile('postgres')139 def test__postgres__model_a_only_singular_unset(self):140 select = 'model_a,test_type:singular'141 exclude = None142 expected = ['cf_a_b','cf_a_src','just_a']143 self.list_tests_and_assert(select, exclude, expected)144 self.run_tests_and_assert(select, exclude, expected)145 @use_profile('postgres')146 def test__postgres__model_a_only_singular_eager(self):147 select = 'model_a,test_type:singular'148 exclude = None149 expected = ['cf_a_b','cf_a_src','just_a']150 indirect_selection = 'eager'151 self.list_tests_and_assert(select, exclude, expected)152 self.run_tests_and_assert(select, exclude, expected)153 @use_profile('postgres')154 def test__postgres__model_a_only_singular_cautious(self):155 select = 'model_a,test_type:singular'156 exclude = None157 expected = ['just_a']158 indirect_selection = 'cautious'159 self.list_tests_and_assert(select, exclude, expected, indirect_selection=indirect_selection)160 self.run_tests_and_assert(select, exclude, expected, indirect_selection=indirect_selection)161 @use_profile('postgres')162 def test__postgres__only_singular(self):163 select = 'test_type:singular'164 exclude = None165 expected = ['cf_a_b', 'cf_a_src', 'just_a']166 self.list_tests_and_assert(select, exclude, expected)167 self.run_tests_and_assert(select, exclude, expected)168 @use_profile('postgres')169 def test__postgres__model_a_only_singular(self):170 select = 'model_a,test_type:singular'171 exclude = None172 expected = ['cf_a_b','cf_a_src','just_a']173 self.list_tests_and_assert(select, exclude, expected)174 self.run_tests_and_assert(select, exclude, expected)175 @use_profile('postgres')176 def test__postgres__test_name_intersection(self):177 select = 'model_a,test_name:unique'178 exclude = None179 expected = ['unique_model_a_fun']180 self.list_tests_and_assert(select, exclude, expected)181 self.run_tests_and_assert(select, exclude, expected)182 @use_profile('postgres')183 def test__postgres__model_tag_test_name_intersection(self):184 select = 'tag:a_or_b,test_name:relationships'185 exclude = None186 expected = [187 'relationships_model_a_fun__fun__ref_model_b_',188 'relationships_model_a_fun__fun__source_my_src_my_tbl_'189 ]190 self.list_tests_and_assert(select, exclude, expected)191 self.run_tests_and_assert(select, exclude, expected)192 @use_profile('postgres')193 def test__postgres__select_column_level_tag(self):194 select = 'tag:column_level_tag'195 exclude = None196 expected = [197 'relationships_model_a_fun__fun__ref_model_b_',198 'relationships_model_a_fun__fun__source_my_src_my_tbl_',199 'unique_model_a_fun'200 ]201 self.list_tests_and_assert(select, exclude, expected)202 self.run_tests_and_assert(select, exclude, expected)203 @use_profile('postgres')204 def test__postgres__exclude_column_level_tag(self):205 select = None206 exclude = 'tag:column_level_tag'207 expected = ['cf_a_b','cf_a_src','just_a','source_unique_my_src_my_tbl_fun']208 self.list_tests_and_assert(select, exclude, expected)209 self.run_tests_and_assert(select, exclude, expected)210 @use_profile('postgres')211 def test__postgres__test_level_tag(self):212 select = 'tag:test_level_tag'213 exclude = None214 expected = ['relationships_model_a_fun__fun__ref_model_b_']215 self.list_tests_and_assert(select, exclude, expected)216 self.run_tests_and_assert(select, exclude, expected)217 @use_profile('postgres')218 def test__postgres__exclude_data_test_tag(self):219 select = 'model_a'220 exclude = 'tag:data_test_tag'221 expected = [222 'cf_a_b', 'cf_a_src',223 'relationships_model_a_fun__fun__ref_model_b_',224 'relationships_model_a_fun__fun__source_my_src_my_tbl_',225 'unique_model_a_fun'226 ]227 self.list_tests_and_assert(select, exclude, expected)228 self.run_tests_and_assert(select, exclude, expected)229 @use_profile('postgres')230 def test__postgres__model_a_indirect_selection(self):231 select = 'model_a'232 exclude = None233 expected = [234 'cf_a_b', 'cf_a_src', 'just_a',235 'relationships_model_a_fun__fun__ref_model_b_',236 'relationships_model_a_fun__fun__source_my_src_my_tbl_',237 'unique_model_a_fun'238 ]239 self.list_tests_and_assert(select, exclude, expected)240 self.run_tests_and_assert(select, exclude, expected)241 @use_profile('postgres')242 def test__postgres__model_a_indirect_selection_eager(self):243 select = 'model_a'244 exclude = None245 expected = [246 'cf_a_b', 'cf_a_src', 'just_a',247 'relationships_model_a_fun__fun__ref_model_b_',248 'relationships_model_a_fun__fun__source_my_src_my_tbl_',249 'unique_model_a_fun'250 ]251 indirect_selection = 'eager'252 self.list_tests_and_assert(select, exclude, expected, indirect_selection)253 self.run_tests_and_assert(select, exclude, expected, indirect_selection)254 @use_profile('postgres')255 def test__postgres__model_a_indirect_selection_exclude_unique_tests(self):256 select = 'model_a'257 exclude = 'test_name:unique'258 indirect_selection = 'eager'259 expected = [260 'cf_a_b', 'cf_a_src', 'just_a',261 'relationships_model_a_fun__fun__ref_model_b_',262 'relationships_model_a_fun__fun__source_my_src_my_tbl_',263 ]264 self.list_tests_and_assert(select, exclude, expected, indirect_selection)265 self.run_tests_and_assert(select, exclude, expected, indirect_selection=indirect_selection)266class TestExpansionWithSelectors(TestSelectionExpansion):267 @property268 def selectors_config(self):269 return yaml.safe_load('''270 selectors:271 - name: model_a_unset_indirect_selection272 definition:273 method: fqn274 value: model_a275 - name: model_a_no_indirect_selection276 definition:277 method: fqn278 value: model_a279 indirect_selection: "cautious"280 - name: model_a_yes_indirect_selection281 definition:282 method: fqn283 value: model_a284 indirect_selection: "eager"285 ''')286 @use_profile('postgres')287 def test__postgres__selector_model_a_unset_indirect_selection(self):288 expected = [289 'cf_a_b', 'cf_a_src', 'just_a',290 'relationships_model_a_fun__fun__ref_model_b_',291 'relationships_model_a_fun__fun__source_my_src_my_tbl_',292 'unique_model_a_fun'293 ]294 self.list_tests_and_assert(include=None, exclude=None, expected_tests=expected, selector_name='model_a_unset_indirect_selection')295 self.run_tests_and_assert(include=None, exclude=None, expected_tests=expected, selector_name='model_a_unset_indirect_selection')296 @use_profile('postgres')297 def test__postgres__selector_model_a_no_indirect_selection(self):298 expected = ['just_a','unique_model_a_fun']299 self.list_tests_and_assert(include=None, exclude=None, expected_tests=expected, selector_name='model_a_no_indirect_selection')300 self.run_tests_and_assert(include=None, exclude=None, expected_tests=expected, selector_name='model_a_no_indirect_selection')301 @use_profile('postgres')302 def test__postgres__selector_model_a_yes_indirect_selection(self):303 expected = [304 'cf_a_b', 'cf_a_src', 'just_a',305 'relationships_model_a_fun__fun__ref_model_b_',306 'relationships_model_a_fun__fun__source_my_src_my_tbl_',307 'unique_model_a_fun'308 ]309 self.list_tests_and_assert(include=None, exclude=None, expected_tests=expected, selector_name='model_a_yes_indirect_selection')...

Full Screen

Full Screen

exclusions.py

Source:exclusions.py Github

copy

Full Screen

1#2#3#4from django import forms5from django.views import generic6from django.views.generic.base import TemplateView7from django.contrib import messages8from django.contrib.messages.views import SuccessMessageMixin9from django.views.generic.edit import FormView10from django.core.urlresolvers import reverse_lazy11from django.shortcuts import render12from django.http import HttpResponseRedirect1314#15#16#17from .items import \18 ViewItemList, \19 ViewItemCreate, \20 ViewItemUpdate, \21 ViewDomainNameCreate2223from .forms import \24 ItemForm, \25 DomainNameForm, \26 IpForm, \27 SubnetForm, \28 RangeForm, \29 AdvancedForm3031from squid.models import \32 ExcludeDomainName, ExcludeDomainIp, ExcludeDomainSubnet, ExcludeDomainRange, \33 ExcludeUserName, ExcludeUserIp, ExcludeUserSubnet, ExcludeUserRange, ExcludeUserAgent, \34 ExcludeContentType, \35 ExcludeSchedule, \36 ExcludeAdvanced, \37 ExcludeCategories3839#40# exclude by domain name41#42class ViewExcludeDomainNameList(ViewItemList):4344 model = ExcludeDomainName45 template_name = "squid/exclude/domainname/list.html"46 47 def get_success_url(self): 48 return reverse_lazy("ViewExcludeDomainNameList")4950class ExcludeDomainNameForm(DomainNameForm):5152 class Meta:53 model = ExcludeDomainName54 fields = '__all__'5556class ViewExcludeDomainNameCreate(ViewDomainNameCreate):5758 model = ExcludeDomainName59 form_class = ExcludeDomainNameForm60 template_name = "squid/exclude/domainname/form.html"61 62 def get_success_url(self): 63 return reverse_lazy("ViewExcludeDomainNameList")6465class ViewExcludeDomainNameUpdate(ViewItemUpdate):6667 model = ExcludeDomainName68 form_class = ExcludeDomainNameForm69 template_name = "squid/exclude/domainname/form.html"70 71 def get_success_url(self): 72 return reverse_lazy("ViewExcludeDomainNameList")7374#75# exclude by domain ip76#77class ViewExcludeDomainIpList(ViewItemList):7879 model = ExcludeDomainIp80 template_name = "squid/exclude/domainip/list.html"81 82 def get_success_url(self): 83 return reverse_lazy("ViewExcludeDomainIpList")8485class ExcludeDomainIpForm(IpForm):8687 class Meta:88 model = ExcludeDomainIp89 fields = '__all__'9091class ViewExcludeDomainIpCreate(ViewItemCreate):9293 model = ExcludeDomainIp94 form_class = ExcludeDomainIpForm95 template_name = "squid/exclude/domainip/form.html"96 97 def get_success_url(self): 98 return reverse_lazy("ViewExcludeDomainIpList")99100class ViewExcludeDomainIpUpdate(ViewItemUpdate):101102 model = ExcludeDomainIp103 form_class = ExcludeDomainIpForm104 template_name = "squid/exclude/domainip/form.html"105 106 def get_success_url(self): 107 return reverse_lazy("ViewExcludeDomainIpList")108109#110# exclude by domain range111#112class ViewExcludeDomainRangeList(ViewItemList):113114 model = ExcludeDomainRange115 template_name = "squid/exclude/domainrange/list.html"116 117 def get_success_url(self): 118 return reverse_lazy("ViewExcludeDomainRangeList")119120class ExcludeDomainRangeForm(RangeForm):121122 class Meta:123 model = ExcludeDomainRange124 fields = '__all__'125126class ViewExcludeDomainRangeCreate(ViewItemCreate):127128 model = ExcludeDomainRange129 form_class = ExcludeDomainRangeForm130 template_name = "squid/exclude/domainrange/form.html"131 132 def get_success_url(self): 133 return reverse_lazy("ViewExcludeDomainRangeList")134135class ViewExcludeDomainRangeUpdate(ViewItemUpdate):136137 model = ExcludeDomainRange138 form_class = ExcludeDomainRangeForm139 template_name = "squid/exclude/domainrange/form.html"140 141 def get_success_url(self): 142 return reverse_lazy("ViewExcludeDomainRangeList")143144#145# exclude by domain subnet146#147class ViewExcludeDomainSubnetList(ViewItemList):148149 model = ExcludeDomainSubnet150 template_name = "squid/exclude/domainsubnet/list.html"151 152 def get_success_url(self): 153 return reverse_lazy("ViewExcludeDomainSubnetList")154155class ExcludeDomainSubnetForm(SubnetForm):156157 class Meta:158 model = ExcludeDomainSubnet159 fields = '__all__'160161class ViewExcludeDomainSubnetCreate(ViewItemCreate):162163 model = ExcludeDomainSubnet164 form_class = ExcludeDomainSubnetForm165 template_name = "squid/exclude/domainsubnet/form.html"166 167 def get_success_url(self): 168 return reverse_lazy("ViewExcludeDomainSubnetList")169170class ViewExcludeDomainSubnetUpdate(ViewItemUpdate):171172 model = ExcludeDomainSubnet173 form_class = ExcludeDomainSubnetForm174 template_name = "squid/exclude/domainsubnet/form.html"175 176 def get_success_url(self): 177 return reverse_lazy("ViewExcludeDomainSubnetList")178179#180# exclude by user ip181#182class ViewExcludeUserIpList(ViewItemList):183184 model = ExcludeUserIp185 template_name = "squid/exclude/userip/list.html"186 187 def get_success_url(self): 188 return reverse_lazy("ViewExcludeUserIpList")189190class ExcludeUserIpForm(IpForm):191192 class Meta:193 model = ExcludeUserIp194 fields = '__all__'195196class ViewExcludeUserIpCreate(ViewItemCreate):197198 model = ExcludeUserIp199 form_class = ExcludeUserIpForm200 template_name = "squid/exclude/userip/form.html"201 202 def get_success_url(self): 203 return reverse_lazy("ViewExcludeUserIpList")204205class ViewExcludeUserIpUpdate(ViewItemUpdate):206207 model = ExcludeUserIp208 form_class = ExcludeUserIpForm209 template_name = "squid/exclude/userip/form.html"210 211 def get_success_url(self): 212 return reverse_lazy("ViewExcludeUserIpList")213214#215# exclude by user range216#217class ViewExcludeUserRangeList(ViewItemList):218219 model = ExcludeUserRange220 template_name = "squid/exclude/userrange/list.html"221 222 def get_success_url(self): 223 return reverse_lazy("ViewExcludeUserRangeList")224225class ExcludeUserRangeForm(RangeForm):226227 class Meta:228 model = ExcludeUserRange229 fields = '__all__'230231class ViewExcludeUserRangeCreate(ViewItemCreate):232233 model = ExcludeUserRange234 form_class = ExcludeUserRangeForm235 template_name = "squid/exclude/userrange/form.html"236 237 def get_success_url(self): 238 return reverse_lazy("ViewExcludeUserRangeList")239240class ViewExcludeUserRangeUpdate(ViewItemUpdate):241242 model = ExcludeUserRange243 form_class = ExcludeUserRangeForm244 template_name = "squid/exclude/userrange/form.html"245 246 def get_success_url(self): 247 return reverse_lazy("ViewExcludeUserRangeList")248249#250# exclude by user subnet251#252class ViewExcludeUserSubnetList(ViewItemList):253254 model = ExcludeUserSubnet255 template_name = "squid/exclude/usersubnet/list.html"256 257 def get_success_url(self): 258 return reverse_lazy("ViewExcludeUserSubnetList")259260class ExcludeUserSubnetForm(SubnetForm):261262 class Meta:263 model = ExcludeUserSubnet264 fields = '__all__'265266class ViewExcludeUserSubnetCreate(ViewItemCreate):267268 model = ExcludeUserSubnet269 form_class = ExcludeUserSubnetForm270 template_name = "squid/exclude/usersubnet/form.html"271 272 def get_success_url(self): 273 return reverse_lazy("ViewExcludeUserSubnetList")274275class ViewExcludeUserSubnetUpdate(ViewItemUpdate):276277 model = ExcludeUserSubnet278 form_class = ExcludeUserSubnetForm279 template_name = "squid/exclude/usersubnet/form.html"280 281 def get_success_url(self): 282 return reverse_lazy("ViewExcludeUserSubnetList")283284#285# exclude by user agent286#287class ViewExcludeUserAgentList(ViewItemList):288289 model = ExcludeUserAgent290 template_name = "squid/exclude/useragent/list.html"291 292 def get_success_url(self): 293 return reverse_lazy("ViewExcludeUserAgentList")294295class ExcludeUserAgentForm(ItemForm):296297 class Meta:298 model = ExcludeUserAgent299 fields = '__all__'300301class ViewExcludeUserAgentCreate(ViewItemCreate):302303 model = ExcludeUserAgent304 form_class = ExcludeUserAgentForm305 template_name = "squid/exclude/useragent/form.html"306 307 def get_success_url(self): 308 return reverse_lazy("ViewExcludeUserAgentList")309310class ViewExcludeUserAgentUpdate(ViewItemUpdate):311312 model = ExcludeUserAgent313 form_class = ExcludeUserAgentForm314 template_name = "squid/exclude/useragent/form.html"315 316 def get_success_url(self): 317 return reverse_lazy("ViewExcludeUserAgentList")318319#320# exclude by content type321#322class ViewExcludeContentTypeList(ViewItemList):323324 model = ExcludeContentType325 template_name = "squid/exclude/contenttype/list.html"326 327 def get_success_url(self): 328 return reverse_lazy("ViewExcludeContentTypeList")329330class ExcludeContentTypeForm(ItemForm):331332 class Meta:333 model = ExcludeContentType334 fields = '__all__'335336 def clean_value(self):337 value = self.cleaned_data['value'] 338 try:339 (part1, part2) = value.split("/") 340 except:341 raise forms.ValidationError("Specified Content Type value should be written as string/string, for example image/gif.") 342 return value.lower()343344class ViewExcludeContentTypeCreate(ViewItemCreate):345346 model = ExcludeContentType347 form_class = ExcludeContentTypeForm348 template_name = "squid/exclude/contenttype/form.html"349 350 def get_success_url(self): 351 return reverse_lazy("ViewExcludeContentTypeList")352353class ViewExcludeContentTypeUpdate(ViewItemUpdate):354355 model = ExcludeContentType356 form_class = ExcludeContentTypeForm357 template_name = "squid/exclude/contenttype/form.html"358 359 def get_success_url(self): 360 return reverse_lazy("ViewExcludeContentTypeList")361362#363# exclude by schedule364#365class ViewExcludeScheduleList(ViewItemList):366367 model = ExcludeSchedule368 template_name = "squid/exclude/schedule/list.html"369 370 def get_success_url(self): 371 return reverse_lazy("ViewExcludeScheduleList")372373class ExcludeScheduleForm(ItemForm):374375 class Meta:376 model = ExcludeSchedule377 fields = '__all__'378379class ViewExcludeScheduleCreate(ViewItemCreate):380381 model = ExcludeSchedule382 form_class = ExcludeScheduleForm383 template_name = "squid/exclude/schedule/form.html"384 385 def get_success_url(self): 386 return reverse_lazy("ViewExcludeScheduleList")387388class ViewExcludeScheduleUpdate(ViewItemUpdate):389390 model = ExcludeSchedule391 form_class = ExcludeScheduleForm392 template_name = "squid/exclude/schedule/form.html"393 394 def get_success_url(self): 395 return reverse_lazy("ViewExcludeScheduleList")396397#398# exclude advanced399#400401class ViewExcludeBase(ViewItemUpdate):402403 model = ExcludeAdvanced404 405 def get_object(self): 406 return ExcludeAdvanced.objects.first()407408class ViewExcludeAdvancedSsl(ViewExcludeBase):409410 fields = ['value_sslbump']411 template_name = "squid/exclude/advanced/form_ssl.html"412 413 def get_success_url(self): 414 return reverse_lazy("ViewExcludeAdvancedSsl")415416417class ViewExcludeAdvancedAdaptation(ViewExcludeBase):418419 fields = ['value_adaptation']420 template_name = "squid/exclude/advanced/form_adaptation.html"421 422 def get_success_url(self): 423 return reverse_lazy("ViewExcludeAdvancedAdaptation")424425426class ViewExcludeAdvancedAuth(ViewExcludeBase):427428 fields = ['value_auth']429 template_name = "squid/exclude/advanced/form_auth.html"430 431 def get_success_url(self): 432 return reverse_lazy("ViewExcludeAdvancedAuth")433434class ViewExcludeAdvancedCache(ViewExcludeBase):435436 fields = ['value_cache']437 template_name = "squid/exclude/advanced/form_cache.html"438 439 def get_success_url(self): 440 return reverse_lazy("ViewExcludeAdvancedCache")441442class ViewExcludeAdvancedUrlRewriter(ViewExcludeBase):443444 fields = ['value_urlrewrite']445 template_name = "squid/exclude/advanced/form_urlrewriter.html"446 447 def get_success_url(self): 448 return reverse_lazy("ViewExcludeAdvancedUrlRewriter")449450451#452# exclude by category453#454class ExcludeCategoriesForm(AdvancedForm):455456 class Meta:457 model = ExcludeCategories458 fields = '__all__'459460class ViewExcludeCategoryUpdate(ViewItemUpdate):461462 model = ExcludeCategories463 form_class = ExcludeCategoriesForm464 success_message = "need_squid_restart"465 template_name = "squid/exclude/categories/form.html"466 467 def get_success_url(self): 468 return reverse_lazy("ViewExcludeCategoryUpdate")469470 def get_object(self): ...

Full Screen

Full Screen

WebCore.gyp

Source:WebCore.gyp Github

copy

Full Screen

1{2 'includes': [3 '../../gyp/common.gypi',4 '../WebCore.gypi',5 ],6 'configurations': {7 'Production': {8 'xcode_config_file': '<(project_dir)/Configurations/Base.xcconfig',9 },10 'Release': {11 'xcode_config_file': '<(project_dir)/Configurations/DebugRelease.xcconfig',12 'xcode_settings': {13 'STRIP_INSTALLED_PRODUCT': 'NO',14 },15 },16 'Debug': {17 'xcode_config_file': '<(project_dir)/Configurations/DebugRelease.xcconfig',18 'xcode_settings': {19 'DEAD_CODE_STRIPPING': '$(DEAD_CODE_STRIPPING_debug)',20 'DEBUG_DEFINES': '$(DEBUG_DEFINES_debug)',21 'GCC_OPTIMIZATION_LEVEL': '$(GCC_OPTIMIZATION_LEVEL_debug)',22 'STRIP_INSTALLED_PRODUCT': '$(STRIP_INSTALLED_PRODUCT_debug)',23 },24 },25 },26 'targets': [27 {28 'target_name': 'WebCore',29 'type': 'shared_library',30 'dependencies': [31 'Derived Sources',32 'Update Version',33 # FIXME: Add 'Copy Generated Headers',34 # FIXME: Add 'Copy Forwarding and ICU Headers',35 # FIXME: Add 'Copy Inspector Resources',36 ],37 'include_dirs': [38 '<(project_dir)',39 '<(project_dir)/icu',40 '<(project_dir)/ForwardingHeaders',41 '<(PRODUCT_DIR)/usr/local/include',42 '/usr/include/libxml2',43 '<(PRODUCT_DIR)/DerivedSources',44 '<(PRODUCT_DIR)/DerivedSources/WebCore',45 ],46 'sources': [47 '<@(webcore_files)',48 '<@(webcore_privateheader_files)',49 '<@(webcore_derived_source_files)',50 '$(SDKROOT)/System/Library/Frameworks/Accelerate.framework',51 '$(SDKROOT)/System/Library/Frameworks/ApplicationServices.framework',52 '$(SDKROOT)/System/Library/Frameworks/AudioToolbox.framework',53 '$(SDKROOT)/System/Library/Frameworks/AudioUnit.framework',54 '$(SDKROOT)/System/Library/Frameworks/Carbon.framework',55 '$(SDKROOT)/System/Library/Frameworks/Cocoa.framework',56 '$(SDKROOT)/System/Library/Frameworks/CoreAudio.framework',57 '$(SDKROOT)/System/Library/Frameworks/IOKit.framework',58 '$(SDKROOT)/System/Library/Frameworks/OpenGL.framework',59 '$(SDKROOT)/System/Library/Frameworks/QuartzCore.framework',60 '$(SDKROOT)/System/Library/Frameworks/SystemConfiguration.framework',61 '<(PRODUCT_DIR)/JavaScriptCore.framework',62 'libicucore.dylib',63 'libobjc.dylib',64 'libxml2.dylib',65 'libz.dylib',66 ],67 'sources/': [68 ['exclude', 'bindings/[^/]+/'],69 ['include', 'bindings/generic/'],70 ['include', 'bindings/js/'],71 ['include', 'bindings/objc/'],72 # FIXME: This could should move to Source/ThirdParty.73 ['exclude', 'thirdparty/'],74 # FIXME: Figure out how to store these patterns in a variable.75 ['exclude', '(cairo|chromium|curl|efl|freetype|fftw|gstreamer|gtk|linux|mkl|openvg|pango|qt|skia|soup|symbian|texmap|iphone|v8|win|wince|wx)/'],76 ['exclude', '(Cairo|Curl|Chromium|Efl|Gtk|Linux|OpenType|Qt|Safari|Soup|Symbian|V8|Win|WinCE|Wx)\\.(cpp|mm?)$'],77 ['exclude', 'Chromium[^/]*\\.(cpp|mm?)$'],78 ['exclude', 'platform/image-decoders/'],79 ['exclude', 'platform/image-encoders/'],80 ['exclude', 'bridge/testbindings\\.cpp$'], # Remove from GYPI?81 ['exclude', 'bridge/testbindings\\.mm$'], # Remove from GYPI?82 ['exclude', 'bridge/testqtbindings\\.cpp$'], # Remove from GYPI?83 ['exclude', 'platform/KillRingNone\\.cpp$'],84 ['exclude', 'platform/graphics/cg/FontPlatformData\\.h$'],85 ['exclude', 'platform/graphics/gpu/LoopBlinnPathProcessor\\.(cpp|h)$'],86 ['exclude', 'platform/graphics/gpu/LoopBlinnLocalTriangulator\\.(cpp|h)$'],87 ['exclude', 'platform/graphics/gpu/LoopBlinnPathCache\\.(cpp|h)$'],88 ['exclude', 'platform/graphics/gpu/LoopBlinnShader\\.(cpp|h)$'],89 ['exclude', 'platform/graphics/gpu/LoopBlinnSolidFillShader\\.(cpp|h)$'],90 # FIXME: Consider excluding GL as a suffix.91 ['exclude', 'platform/graphics/ImageSource\\.cpp$'],92 ['exclude', 'platform/graphics/opengl/TextureMapperGL\\.cpp$'],93 ['exclude', 'platform/graphics/opentype/OpenTypeUtilities\\.(cpp|h)$'],94 ['exclude', 'platform/posix/SharedBufferPOSIX\\.cpp$'],95 ['exclude', 'platform/text/Hyphenation\\.cpp$'],96 ['exclude', 'platform/text/LocalizedNumberICU\\.cpp$'],97 ['exclude', 'platform/text/LocalizedNumberNone\\.cpp$'],98 ['exclude', 'platform/text/TextEncodingDetectorNone\\.cpp$'],99 ['exclude', 'plugins/PluginDataNone\\.cpp$'],100 ['exclude', 'plugins/PluginDatabase\\.cpp$'],101 ['exclude', 'plugins/PluginPackageNone\\.cpp$'],102 ['exclude', 'plugins/PluginPackage\\.cpp$'],103 ['exclude', 'plugins/PluginStream\\.cpp$'],104 ['exclude', 'plugins/PluginView\\.cpp$'],105 ['exclude', 'plugins/mac/PluginPackageMac\\.cpp$'],106 ['exclude', 'plugins/mac/PluginViewMac\\.mm$'],107 ['exclude', 'plugins/npapi\\.cpp$'],108 # FIXME: Check whether we need to build these derived source files.109 ['exclude', 'JSAbstractView\\.(cpp|h)'],110 ['exclude', 'JSElementTimeControl\\.(cpp|h)'],111 ['exclude', 'JSMathMLElementWrapperFactory\\.(cpp|h)'],112 ['exclude', 'JSSVGExternalResourcesRequired\\.(cpp|h)'],113 ['exclude', 'JSSVGFilterPrimitiveStandardAttributes\\.(cpp|h)'],114 ['exclude', 'JSSVGFitToViewBox\\.(cpp|h)'],115 ['exclude', 'JSSVGLangSpace\\.(cpp|h)'],116 ['exclude', 'JSSVGLocatable\\.(cpp|h)'],117 ['exclude', 'JSSVGStylable\\.(cpp|h)'],118 ['exclude', 'JSSVGTests\\.(cpp|h)'],119 ['exclude', 'JSSVGTransformable\\.(cpp|h)'],120 ['exclude', 'JSSVGURIReference\\.(cpp|h)'],121 ['exclude', 'JSSVGZoomAndPan\\.(cpp|h)'],122 ['exclude', 'tokenizer\\.cpp'],123 ['exclude', 'AllInOne\\.cpp$'],124 ['exclude', 'rendering/svg/[^/]+\\.cpp'],125 ['include', 'rendering/svg/RenderSVGAllInOne\\.cpp$'],126 ],127 'mac_framework_private_headers': [128 '<@(webcore_privateheader_files)',129 ],130 'mac_bundle_resources': [131 '<@(webcore_resource_files)',132 ],133 'xcode_config_file': '<(project_dir)/Configurations/WebCore.xcconfig',134 # FIXME: A number of these actions aren't supposed to run if "${ACTION}" = "installhdrs"135 'postbuilds': [136 {137 'postbuild_name': 'Check For Global Initializers',138 'action': [139 'sh', '<(project_dir)/gyp/run-if-exists.sh', '<(DEPTH)/../Tools/Scripts/check-for-global-initializers'140 ],141 },142 {143 'postbuild_name': 'Check For Exit Time Destructors',144 'action': [145 'sh', '<(project_dir)/gyp/run-if-exists.sh', '<(DEPTH)/../Tools/Scripts/check-for-exit-time-destructors'146 ],147 },148 {149 'postbuild_name': 'Check For Weak VTables and Externals',150 'action': [151 'sh', '<(project_dir)/gyp/run-if-exists.sh', '<(DEPTH)/../Tools/Scripts/check-for-weak-vtables-and-externals'152 ],153 },154 {155 'postbuild_name': 'Copy Forwarding and ICU Headers',156 'action': [157 'sh', '<(project_dir)/gyp/copy-forwarding-and-icu-headers.sh'158 ],159 },160 {161 'postbuild_name': 'Copy Inspector Resources',162 'action': [163 'sh', '<(project_dir)/gyp/copy-inspector-resources.sh'164 ],165 },166 {167 'postbuild_name': 'Streamline Inspector Source',168 'action': [169 'sh', '<(project_dir)/gyp/streamline-inspector-source.sh'170 ],171 },172 {173 'postbuild_name': 'Check For Inappropriate Files in Framework',174 'action': [175 'sh', '<(project_dir)/gyp/run-if-exists.sh', '<(DEPTH)/../Tools/Scripts/check-for-inappropriate-files-in-framework'176 ],177 },178 ],179 'conditions': [180 ['OS=="mac"', {181 'mac_bundle': 1,182 'xcode_settings': {183 # FIXME: Remove these overrides once WebCore.xcconfig is184 # used only by this project.185 'GCC_PREFIX_HEADER': '<(project_dir)/WebCorePrefix.h',186 'INFOPLIST_FILE': '<(project_dir)/Info.plist',187 'ALWAYS_SEARCH_USER_PATHS': 'NO',188 },189 }],190 ],191 },192 {193 'target_name': 'Derived Sources',194 'type': 'none',195 'dependencies': [196 'WebCoreExportFileGenerator',197 ],198 'xcode_config_file': '<(project_dir)/Configurations/WebCore.xcconfig',199 'actions': [{200 'action_name': 'Generate Derived Sources',201 'inputs': [],202 'outputs': [],203 'action': [204 'sh', 'generate-derived-sources.sh',205 ],206 }],207 },208 {209 'target_name': 'Update Version',210 'type': 'none',211 'actions': [{212 'action_name': 'Update Info.plist with version information',213 'inputs': [],214 'outputs': [],215 'action': [216 'sh', '<(project_dir)/gyp/update-info-plist.sh', '<(project_dir)/Info.plist'217 ]218 }],219 },220 {221 'target_name': 'WebCoreExportFileGenerator Generator',222 'type': 'none',223 'actions': [{224 'action_name': 'Generate Export File Generator',225 'inputs': [226 '<(project_dir)/WebCore.exp.in',227 ],228 'outputs': [229 '<@(export_file_generator_files)',230 ],231 'action': [232 'sh', '<(project_dir)/gyp/generate-webcore-export-file-generator.sh',233 ],234 }],235 },236 {237 'target_name': 'WebCoreExportFileGenerator',238 'type': 'executable',239 'dependencies': [240 'WebCoreExportFileGenerator Generator',241 ],242 'include_dirs': [243 '<(project_dir)/ForwardingHeaders',244 ],245 'xcode_config_file': '<(project_dir)/Configurations/WebCore.xcconfig',246 'configurations': {247 'Production': {248 'EXPORTED_SYMBOLS_FILE': '',249 'GCC_OPTIMIZATION_LEVEL': '0',250 'INSTALL_PATH': '/usr/local/bin',251 'OTHER_LDFLAGS': '',252 'SKIP_INSTALL': 'YES',253 },254 'Release': {255 'xcode_settings': {256 'EXPORTED_SYMBOLS_FILE': '',257 'GCC_OPTIMIZATION_LEVEL': '0',258 'INSTALL_PATH': '/usr/local/bin',259 'OTHER_LDFLAGS': '',260 'SKIP_INSTALL': 'YES',261 },262 },263 'Debug': {264 'xcode_settings': {265 'EXPORTED_SYMBOLS_FILE': '',266 'GCC_OPTIMIZATION_LEVEL': '0',267 'INSTALL_PATH': '/usr/local/bin',268 'OTHER_LDFLAGS': '',269 'SKIP_INSTALL': 'YES',270 },271 },272 },273 'sources': [274 '<@(export_file_generator_files)',275 ],276 'conditions': [277 ['OS=="mac"', {278 'xcode_settings': {279 # FIXME: Remove these overrides once WebCore.xcconfig is280 # used only by this project.281 'GCC_PREFIX_HEADER': '<(project_dir)/WebCorePrefix.h',282 'INFOPLIST_FILE': '<(project_dir)/Info.plist',283 },284 }],285 ],286 },287 ], # targets...

Full Screen

Full Screen

fastq_trimmer_by_quality.py

Source:fastq_trimmer_by_quality.py Github

copy

Full Screen

...16 elif operator == '<=':17 return aggregated_value <= threshold_value18 elif operator == '!=':19 return aggregated_value != threshold_value20def exclude( value_list, exclude_indexes ):21 rval = []22 for i, val in enumerate( value_list ):23 if i not in exclude_indexes:24 rval.append( val )25 return rval26def exclude_and_compare( aggregate_action, aggregate_list, operator, threshold_value, exclude_indexes = None ):27 if not aggregate_list or compare( aggregate_action( aggregate_list ), operator, threshold_value ):28 return True29 if exclude_indexes:30 for exclude_index in exclude_indexes:31 excluded_list = exclude( aggregate_list, exclude_index )32 if not excluded_list or compare( aggregate_action( excluded_list ), operator, threshold_value ):33 return True34 return False35def main():36 usage = "usage: %prog [options] input_file output_file"37 parser = OptionParser( usage=usage )38 parser.add_option( '-f', '--format', dest='format', type='choice', default='sanger', choices=( 'sanger', 'cssanger', 'solexa', 'illumina' ), help='FASTQ variant type' )39 parser.add_option( '-s', '--window_size', type="int", dest='window_size', default='1', help='Window size' )40 parser.add_option( '-t', '--window_step', type="int", dest='window_step', default='1', help='Window step' )41 parser.add_option( '-e', '--trim_ends', type="choice", dest='trim_ends', default='53', choices=('5','3','53','35' ), help='Ends to Trim' )42 parser.add_option( '-a', '--aggregation_action', type="choice", dest='aggregation_action', default='min', choices=('min','max','sum','mean' ), help='Aggregate action for window' )43 parser.add_option( '-x', '--exclude_count', type="int", dest='exclude_count', default='0', help='Maximum number of bases to exclude from the window during aggregation' )44 parser.add_option( '-c', '--score_comparison', type="choice", dest='score_comparison', default='>=', choices=('>','>=','==','<', '<=', '!=' ), help='Keep read when aggregate score is' )45 parser.add_option( '-q', '--quality_score', type="float", dest='quality_score', default='0', help='Quality Score' )...

Full Screen

Full Screen

filename_rules.gypi

Source:filename_rules.gypi Github

copy

Full Screen

1# Copyright (c) 2012 The Chromium Authors. All rights reserved.2# Use of this source code is governed by a BSD-style license that can be3# found in the LICENSE file.4# This gypi file defines the patterns used for determining whether a5# file is excluded from the build on a given platform. It is6# included by common.gypi for chromium_code.7{8 'conditions': [9 ['OS!="win"', {10 'sources/': [ ['exclude', '_win(_unittest)?\\.(h|cc)$'],11 ['exclude', '(^|/)win/'],12 ['exclude', '(^|/)win_[^/]*\\.(h|cc)$'] ],13 }],14 ['OS!="mac"', {15 'sources/': [ ['exclude', '_(cocoa|mac)(_unittest)?\\.(h|cc)$'],16 ['exclude', '(^|/)(cocoa|mac)/'],17 ['exclude', '\\.mm?$' ] ],18 }],19 # Do not exclude the linux files on *BSD since most of them can be20 # shared at this point.21 # In case a file is not needed, it is going to be excluded later on.22 # TODO(evan): the above is not correct; we shouldn't build _linux23 # files on non-linux.24 ['OS!="linux" and OS!="openbsd" and OS!="freebsd"', {25 'sources/': [26 ['exclude', '_linux(_unittest)?\\.(h|cc)$'],27 ['exclude', '(^|/)linux/'],28 ],29 }],30 ['OS!="android"', {31 'sources/': [32 ['exclude', '_android(_unittest)?\\.cc$'],33 ['exclude', '(^|/)android/'],34 ],35 }],36 ['OS=="win"', {37 'sources/': [ ['exclude', '_posix(_unittest)?\\.(h|cc)$'] ],38 }],39 ['chromeos!=1', {40 'sources/': [ ['exclude', '_chromeos\\.(h|cc)$'] ]41 }],42 ['OS!="linux" and OS!="openbsd" and OS!="freebsd"', {43 'sources/': [44 ['exclude', '_xdg(_unittest)?\\.(h|cc)$'],45 ],46 }],47 ['use_x11!=1', {48 'sources/': [49 ['exclude', '_(chromeos|x|x11)(_unittest)?\\.(h|cc)$'],50 ['exclude', '(^|/)x11_[^/]*\\.(h|cc)$'],51 ],52 }],53 ['toolkit_uses_gtk!=1', {54 'sources/': [55 ['exclude', '_gtk(_unittest)?\\.(h|cc)$'],56 ['exclude', '(^|/)gtk/'],57 ['exclude', '(^|/)gtk_[^/]*\\.(h|cc)$'],58 ],59 }],60 ['toolkit_views==0', {61 'sources/': [ ['exclude', '_views\\.(h|cc)$'] ]62 }],63 ['use_aura==0', {64 'sources/': [ ['exclude', '_aura(_unittest)?\\.(h|cc)$'],65 ['exclude', '(^|/)aura/'],66 ]67 }],68 ['use_aura==0 or use_x11==0', {69 'sources/': [ ['exclude', '_aurax11\\.(h|cc)$'] ]70 }],71 ['use_aura==0 or OS!="win"', {72 'sources/': [ ['exclude', '_aurawin\\.(h|cc)$'] ]73 }],74 ['use_ash==0', {75 'sources/': [ ['exclude', '_ash(_unittest)?\\.(h|cc)$'],76 ['exclude', '(^|/)ash/'],77 ]78 }],79 ['use_wayland!=1', {80 'sources/': [81 ['exclude', '_(wayland)(_unittest)?\\.(h|cc)$'],82 ['exclude', '(^|/)wayland/'],83 ['exclude', '(^|/)(wayland)_[^/]*\\.(h|cc)$'],84 ],85 }],86 ]...

Full Screen

Full Screen

builders.py

Source:builders.py Github

copy

Full Screen

1# This program is free software; you can redistribute it and/or modify2# it under the terms of the GNU Affero General Public License as published by3# the Free Software Foundation; either version 3 of the License, or4# (at your option) any later version.5#6# This program is distributed in the hope that it will be useful,7# but WITHOUT ANY WARRANTY; without even the implied warranty of8# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.9#10# See LICENSE for more details.11#12# Copyright (c) 2021 ScyllaDB13from typing import Union14from pydantic import BaseModel # pylint: disable=no-name-in-module15OptionalType = type(Union[str, None])16class AttrBuilder(BaseModel):17 @classmethod18 def get_properties(cls):19 return [prop for prop in dir(cls) if isinstance(getattr(cls, prop), property) and prop[0] != '_']20 @property21 def _exclude_by_default(self):22 exclude_fields = []23 for field_name, field in self.__fields__.items():24 if not field.field_info.extra.get('as_dict', True):25 exclude_fields.append(field_name)26 return set(exclude_fields)27 def dict(28 self,29 *,30 include: Union['AbstractSetIntStr', 'MappingIntStrAny'] = None,31 exclude: Union['AbstractSetIntStr', 'MappingIntStrAny'] = None,32 by_alias: bool = False,33 skip_defaults: bool = None,34 exclude_unset: bool = False,35 exclude_defaults: bool = False,36 exclude_none: bool = False,37 ) -> 'DictStrAny':38 """39 Pydantic does not treat properties as fields, so you can't get their values when call dict40 This function is to enable property extraction41 """42 if exclude is None:43 exclude = self._exclude_by_default44 attribs = super().dict(45 include=include,46 exclude=exclude,47 by_alias=by_alias,48 skip_defaults=skip_defaults,49 exclude_unset=exclude_unset,50 exclude_defaults=exclude_defaults,51 exclude_none=exclude_none52 )53 props = self.get_properties()54 if include:55 props = [prop for prop in props if prop in include]56 if exclude:57 props = [prop for prop in props if prop not in exclude]58 if props:59 if exclude_unset or exclude_none or exclude_defaults:60 for prop in props:61 prop_value = getattr(self, prop)62 if prop_value is not None:63 attribs[prop] = prop_value64 else:65 attribs.update({prop: getattr(self, prop) for prop in props})...

Full Screen

Full Screen

options.py

Source:options.py Github

copy

Full Screen

1# -*- coding: utf-8 -*-2class PublisherOptions(object):3 """Option class which instance is accessible on all models which inherit from4 publisher over `PublisherModel`._publisher_meta.5 6 Populates all fields which should be excluded when the publish method take 7 place. 8 9 Attribute exclude_fields may inherit fields from parents, if there are some10 excluded_fields defined.11 12 PublisherOptions are configurable over class PublisherMeta if preset in 13 class definition in model. If exclude_fields are defined on model instance,14 value of this field will be taken, and inheritance check for exclusions will15 be skipped.16 """17 18 exclude_fields = []19 20 def __init__(self, name, bases, publisher_meta=None):21 """Build publisher meta, and inherit stuff from bases if required 22 """23 if publisher_meta and getattr(publisher_meta, 'exclude_fields', None):24 self.exclude_fields = getattr(publisher_meta, 'exclude_fields', [])25 return26 27 exclude_fields = set()28 29 all_bases = []30 for direct_base in bases:31 all_bases.append(direct_base)32 for base in direct_base.mro():33 if not base in all_bases:34 all_bases.append(base)35 for base in reversed(all_bases):36 #for direct_base in bases:37 #for base in reversed(direct_base.mro()):38 pmeta = getattr(base, '_publisher_meta', None) or getattr(base, 'PublisherMeta', None)39 if not pmeta:40 continue41 base_exclude_fields = getattr(pmeta, 'exclude_fields', None)42 base_exclude_fields_append = getattr(pmeta, 'exclude_fields_append', None)43 44 if base_exclude_fields and base_exclude_fields_append:45 raise ValueError, ("Model %s extends defines PublisherMeta, but " +46 "both - exclude_fields and exclude_fields_append"47 "are defined!") % (name,) 48 if base_exclude_fields:49 exclude_fields = exclude_fields.union(base_exclude_fields)50 elif base_exclude_fields_append:51 exclude_fields = exclude_fields.union(base_exclude_fields_append)52 53 if publisher_meta and getattr(publisher_meta, 'exclude_fields_append', None):54 exclude_fields = exclude_fields.union(publisher_meta.exclude_fields_append)55 ...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var mb = require('mountebank');2var port = 2525;3 {4 {5 {6 is: {7 headers: {8 },9 }10 }11 }12 }13];14mb.create({ port: port, pidfile: 'mb.pid', logfile: 'mb.log', ipWhitelist: ['*'] }, imposters).then(function () {15 console.log('Mountebank started on port %s', port);16});17var mb = require('mountebank');18var port = 2525;19 {20 {21 {22 is: {23 headers: {24 },25 }26 }27 }28 }29];30mb.create({ port: port, pidfile: 'mb.pid', logfile: 'mb.log', ipWhitelist: ['*'] }, imposters).then(function () {31 console.log('Mountebank started on port %s', port);32});33var mb = require('mountebank');34var port = 2525;35 {

Full Screen

Using AI Code Generation

copy

Full Screen

1var mb = require('mountebank');2var imposter = {3 {4 {5 is: { body: 'Hello world' }6 }7 }8};9mb.create(imposter).then(function () {10 return mb.get('/imposters');11}).then(function (response) {12 console.log(response.body);13}).finally(mb.stopAll);14### create(imposter, options)15### get(path, options)16### post(path, data, options)17### put(path, data, options)

Full Screen

Using AI Code Generation

copy

Full Screen

1var mb = require('mountebank');2var port = 2525;3 {4 {5 {6 equals: {7 }8 }9 {10 is: {11 headers: {12 },13 }14 }15 }16 }17];18mb.create({ port: port, pidfile: 'mb.pid' }, function (error) {19 if (error) {20 console.error('Error creating mountebank server', error);21 }22 else {23 mb.start({ imposters: imposters }, function (error) {24 if (error) {25 console.error('Error starting mountebank server', error);26 }27 else {28 console.log('Mountebank server started on port', port);29 }30 });31 }32});33var mb = require('mountebank');34var port = 2525;35 {36 {37 {38 equals: {39 }40 }41 {42 is: {43 headers: {44 },45 }46 }47 }48 }49];50mb.create({ port: port, pidfile: 'mb.pid' }, function (error) {51 if (error) {52 console.error('Error creating mountebank server', error);53 }54 else {55 mb.start({ imposters: imposters }, function (error) {56 if (error) {57 console.error('Error starting mountebank server', error);58 }59 else {60 console.log('Mountebank server started on port', port);61 }62 });63 }64});65var mb = require('mountebank');66var port = 2525;67 {

Full Screen

Using AI Code Generation

copy

Full Screen

1const mb = require('mountebank');2mb.start({3}, function (error) {4 if (error) {5 console.error(error);6 } else {7 console.log('Mountebank started');8 }9});10mb.post('/imposters', {11 {12 {13 equals: {14 }15 }16 {17 is: {18 headers: {19 },20 }21 }22 }23 _links: {24 self: {25 }26 }27}, function (error, response) {28 if (error) {29 console.error(error);30 } else {31 console.log('Imposter created');32 }33});34mb.post('/imposters', {35 {36 {37 equals: {38 }39 }40 {41 is: {42 headers: {43 },44 }45 }46 }47 _links: {48 self: {49 }50 }51}, function (error, response) {52 if (error) {53 console.error(error);54 } else {55 console.log('Imposter created');56 }57});58mb.post('/imposters', {59 {60 {61 equals: {62 }63 }

Full Screen

Using AI Code Generation

copy

Full Screen

1var mb = require('mountebank');2var fs = require('fs');3var imposter = JSON.parse(fs.readFileSync('imposter.json', 'utf8'));4mb.create(imposter, 2525).then(function () {5 console.log('imposter created');6});7{8 {9 {10 "is": {11 }12 }13 {14 "equals": {15 }16 }17 },18 {19 {20 "is": {21 }22 }23 {24 "equals": {25 }26 }27 }28}29var request = require('request');30});31});

Full Screen

Using AI Code Generation

copy

Full Screen

1var mb = require('mountebank');2var assert = require('assert');3var Q = require('q');4var fs = require('fs');5var path = require('path');6var port = 2525;7var host = 'localhost';8var imposterPort = 2526;9var imposterHost = 'localhost';10var imposterPath = path.resolve(__dirname, 'imposter.json');11mb.start({port: port, host: host, pidfile: 'mb.pid', logfile: 'mb.log', protofile: 'mb.proto', ipWhitelist: ['*']}, function () {12 console.log('mountebank started on port ' + port);13 mb.create(imposterUrl, {14 {15 {16 "is": {17 "headers": {18 },19 }20 }21 }22 {23 {24 "not": {25 "path": {26 }27 }28 }29 }30 }, function () {31 console.log('imposter created at ' + imposterUrl);32 var request = require('request');33 request({34 }, function (err, response, body) {35 console.log('response for exclude path: ' + response.statusCode);36 request({37 }, function (err, response, body) {38 console.log('response for include path: ' + response.statusCode);39 mb.get(imposterUrl, function (error, response) {40 console.log('recorded requests: ' + response.body.requests.length);41 assert.equal(response.body.requests.length, 1);42 mb.stop(function () {43 console.log('mountebank stopped');44 });45 });46 });47 });48 });49});

Full Screen

Using AI Code Generation

copy

Full Screen

1const mb = require('mountebank');2const imposters = require('./imposters.json');3const port = 2525;4mb.create(port, imposters, 2526)5 .then(function () {6 console.log('imposters created');7 })8 .catch(function (error) {9 console.error('Error creating imposters', error);10 });11 {12 {13 {14 "is": {15 "headers": {16 },17 "body": "[{\"id\":1,\"name\":\"A green door\",\"price\":12.50,\"tags\":[\"home\",\"green\"]},{\"id\":2,\"name\":\"A blue door\",\"price\":12.50,\"tags\":[\"home\"]},{\"id\":3,\"name\":\"A red door\",\"price\":12.50,\"tags\":[\"home\"]},{\"id\":4,\"name\":\"A yellow door\",\"price\":12.50,\"tags\":[\"home\"]}]"18 }19 }20 {21 "equals": {22 }23 }24 },25 {26 {27 "is": {28 "headers": {29 },30 "body": "[{\"id\":1,\"name\":\"A green door\",\"price\":12.50,\"tags\":[\"home\",\"green\"]},{\"id\":2,\"name\":\"A blue door\",\"price\":12.50,\"tags\":[\"home\"]},{\"id\":3,\"name\":\"A red door\",\"price\":12.50,\"tags\":[\"home\"]},{\"id\":4,\"name\":\"A yellow door\",\"price\":12.50,\"tags\":[\"home\"]}]"31 }32 }33 {34 "equals": {35 }36 }37 }38 }

Full Screen

Using AI Code Generation

copy

Full Screen

1var mb = require('mountebank');2var server = mb.create({3});4server.then(function () {5 return server.post('/imposters', {6 {7 {8 is: {9 headers: {10 },11 }12 }13 }14 _behaviors: {15 exclude: {16 query: {17 }18 }19 }20 });21}).then(function () {22});23var mb = require('mountebank');24var server = mb.create({25});26server.then(function () {27 return server.post('/imposters', {28 {29 {30 is: {31 headers: {32 },33 }34 }35 }36 _behaviors: {37 exclude: {38 query: {39 }40 }41 }42 });43}).then(function () {44});45var mb = require('mountebank');46var server = mb.create({

Full Screen

Using AI Code Generation

copy

Full Screen

1var mb = require('mountebank'),2 fs = require('fs'),3 imposter = JSON.parse(fs.readFileSync('imposter.json', 'utf8'));4mb.create(imposter, 2525).then(function () {5 console.log('Imposter created');6});

Full Screen

Using AI Code Generation

copy

Full Screen

1var mb = require('mountebank');2var imposter = {3 {4 {5 is: {6 headers: {7 },8 body: JSON.stringify({hello: 'world'})9 }10 }11 }12 _behaviors: {13 exclude: {14 }15 }16};17mb.create(imposter, function (error, imposter) {18 console.log('Imposter created at %s', imposter.url);19});

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 mountebank 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