How to use _match_values method in Lemoncheesecake

Best Python code snippet using lemoncheesecake

events.py

Source:events.py Github

copy

Full Screen

...310 value = DataArgumentFilter(arg_type=item['type'])311 yield key, value312array_to_tuple = apply_formatter_if(is_list_like, tuple)313@to_tuple314def _normalize_match_values(match_values):315 for value in match_values:316 yield array_to_tuple(value)317class BaseArgumentFilter(ABC):318 _match_values = None319 _immutable = False320 def __init__(self, arg_type):321 self.arg_type = arg_type322 def match_single(self, value):323 if self._immutable:324 raise ValueError("Setting values is forbidden after filter is deployed.")325 if self._match_values is None:326 self._match_values = _normalize_match_values((value,))327 else:328 raise ValueError("An argument match value/s has already been set.")329 def match_any(self, *values):330 if self._immutable:331 raise ValueError("Setting values is forbidden after filter is deployed.")332 if self._match_values is None:333 self._match_values = _normalize_match_values(values)334 else:335 raise ValueError("An argument match value/s has already been set.")336 @property337 @abstractmethod338 def match_values(self):339 pass340class DataArgumentFilter(BaseArgumentFilter):341 @property342 def match_values(self):343 return (self.arg_type, self._match_values)344class TopicArgumentFilter(BaseArgumentFilter):345 @to_tuple346 def _get_match_values(self):347 yield from (self._encode(value) for value in self._match_values)348 @property349 def match_values(self):350 if self._match_values is not None:351 return self._get_match_values()352 else:353 return None354 def _encode(self, value):355 if is_dynamic_sized_type(self.arg_type):356 return to_hex(keccak(encode_single_packed(self.arg_type, value)))357 else:...

Full Screen

Full Screen

extract_test.py

Source:extract_test.py Github

copy

Full Screen

...58 PythonToJson(config).write_to_json_file(target_path)59 resource = self._extract_domain_resource('1')60 # clusters from topology should be in the domain resource file61 cluster_list = self._traverse(resource, 'spec', 'clusters')62 self._match_values("Cluster count", len(cluster_list), 2)63 self._match_values("Cluster 0 clusterName", cluster_list[0]['clusterName'], 'cluster1')64 self._match_values("Cluster 0 replicas", cluster_list[0]['replicas'], 3)65 self._match_values("Cluster 1 clusterName", cluster_list[1]['clusterName'], 'cluster2')66 self._match_values("Cluster 1 replicas", cluster_list[1]['replicas'], 12)67 # secrets from the model should be in the domain resource file68 secret_list = self._traverse(resource, 'spec', 'configuration', 'secrets')69 self._match_values("Secret count", len(secret_list), 2)70 self._match_values("Secret 0", secret_list[0], 'demodomain-m1-system')71 self._match_values("Secret 1", secret_list[1], 'demodomain-m2-system')72 def testKubernetesModel(self):73 """74 Test that fields from the kubernetes section of the model75 are transferred to the resulting domain resource file76 """77 resource = self._extract_domain_resource('2')78 # clusters from kubernetes section should be in the domain resource file79 cluster_list = self._traverse(resource, 'spec', 'clusters')80 self._match_values("Cluster count", len(cluster_list), 2)81 self._match_values("Cluster 0 clusterName", cluster_list[0]['clusterName'], 'CLUSTER_1')82 self._match_values("Cluster 1 clusterName", cluster_list[1]['clusterName'], 'CLUSTER_2')83 # secrets from the kubernetes section should be in the domain resource file84 secret_list = self._traverse(resource, 'spec', 'configuration', 'secrets')85 self._match_values("Secret count", len(secret_list), 2)86 self._match_values("Secret 0", secret_list[0], 'secret-1')87 self._match_values("Secret 1", secret_list[1], 'secret-2')88 # deprecated89 def testNamedObjectListModel(self):90 """91 Test that fields using the deprecated "named object list" in the kubernetes section of the model92 are transferred to the resulting domain resource file93 """94 resource = self._extract_domain_resource('3')95 # serverPod/env from the kubernetes section should be in the domain resource file96 env_list = self._traverse(resource, 'spec', 'serverPod', 'env')97 self._match_values("Env count", len(env_list), 2)98 self._match_values("Env 0", env_list[0]['name'], 'JAVA_OPTIONS')99 self._match_values("Env 1", env_list[1]['name'], 'USER_MEM_ARGS')100 # clusters from kubernetes section should be in the domain resource file101 cluster_list = self._traverse(resource, 'spec', 'clusters')102 self._match_values("Cluster count", len(cluster_list), 2)103 self._match_values("Cluster 0 clusterName", cluster_list[0]['clusterName'], 'CLUSTER_1')104 self._match_values("Cluster 1 clusterName", cluster_list[1]['clusterName'], 'CLUSTER_2')105 def _extract_domain_resource(self, suffix):106 model_file = os.path.join(self.MODELS_DIR, 'model-' + suffix + '.yaml')107 translator = FileToPython(model_file, use_ordering=True)108 model_dict = translator.parse()109 model = Model(model_dict)110 resource_file = os.path.join(self.EXTRACT_OUTPUT_DIR, 'domain-resource-' + suffix + '.yaml')111 args_map = {112 '-domain_home': '/u01/domain',113 '-oracle_home': '/oracle',114 '-domain_resource_file': resource_file,115 '-target': 'wko'116 }117 model_context = ModelContext('ExtractTest', args_map)118 aliases = Aliases(model_context, WlstModes.OFFLINE, self.wls_version)...

Full Screen

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