Exemple #1
0
 def validate(self):
     super(AdobeReader, self).validate()
     self.uiauto_params['filename'] = self.document_name.replace(' ', '0space0')
     self.uiauto_params['search_string_list'] = '0newline0'.join([x.replace(' ', '0space0') for x in self.search_string_list])
     # Only accept certain file formats
     if os.path.splitext(self.document_name.lower())[1] not in ['.pdf']:
         raise ValidationError('{} must be a PDF file'.format(self.document_name))
 def validate(self):
     super(AdobeReader, self).validate()
     self.uiauto_params['filename'] = self.document_name
     self.uiauto_params['search_string_list'] = self.search_string_list
     # Only accept certain file formats
     if os.path.splitext(self.document_name.lower())[1] not in ['.pdf']:
         raise ValidationError('{} must be a PDF file'.format(
             self.document_name))
 def validate(self):
     super(GoogleSlides, self).validate()
     self.uiauto_params['workdir_name'] = self.device.path.basename(
         self.device.working_directory)
     self.uiauto_params['test_file'] = self.test_file
     self.uiauto_params['slide_count'] = self.slide_count
     self.uiauto_params['do_text_entry'] = self.do_text_entry
     self.uiauto_params['new_doc_name'] = self.new_doc_name
     # Only accept certain image formats
     if os.path.splitext(
             self.test_image.lower())[1] not in ['.jpg', '.jpeg', '.png']:
         raise ValidationError('{} must be a JPEG or PNG file'.format(
             self.test_image))
     # Only accept certain presentation formats
     if os.path.splitext(self.test_file.lower())[1] not in ['.pptx']:
         raise ValidationError('{} must be a PPTX file'.format(
             self.test_file))
Exemple #4
0
    def check_artifacts(self, context, level):
        """
        Make sure that all mandatory artifacts have been generated.

        """
        for artifact in self.artifacts:
            if artifact.level != level or not artifact.mandatory:
                continue
            fullpath = os.path.join(context.output_directory, artifact.path)
            if not os.path.exists(fullpath):
                message = 'Mandatory "{}" has not been generated for {}.'
                raise ValidationError(message.format(artifact.path, self.name))
 def validate(self):
     super(AppShare, self).validate()
     # Set package to None as it doesnt allow it to be a list,
     # and we are not using it in the java side, only in wa itself.
     self.uiauto_params['package_name'] = None
     self.uiauto_params['googlephotos_package'] = self.wl_googlephotos.package
     self.uiauto_params['gmail_package'] = self.wl_gmail.package
     self.uiauto_params['skype_package'] = self.wl_skype.package
     self.uiauto_params['recipient'] = self.email_recipient
     self.uiauto_params['my_id'] = self.skype_login_name
     self.uiauto_params['my_pwd'] = self.skype_login_pass
     self.uiauto_params['name'] = self.skype_contact_name
     # Only accept certain image formats
     if os.path.splitext(self.test_image.lower())[1] not in ['.jpg', '.jpeg', '.png']:
         raise ValidationError('{} must be a JPEG or PNG file'.format(self.test_image))
Exemple #6
0
    def validate(self):
        """
        Perform basic validation to ensure that this extension is capable of running.
        This is intended as an early check to ensure the extension has not been mis-configured,
        rather than a comprehensive check (that may, e.g., require access to the execution
        context).

        This method may also be used to enforce (i.e. set as well as check) inter-parameter
        constraints for the extension (e.g. if valid values for parameter A depend on the value
        of parameter B -- something that is not possible to enfroce using ``Parameter``\ 's
        ``constraint`` attribute.

        """
        if self.name is None:
            raise ValidationError('Name not set for {}'.format(self._classname))
        for param in self.parameters:
            param.validate(self)
 def validate(self):
     super(Googlephotos, self).validate()
     # Only accept certain image formats
     for image in self.test_images:
         if os.path.splitext(image.lower())[1] not in ['.jpg', '.jpeg', '.png']:
             raise ValidationError('{} must be a JPEG or PNG file'.format(image))
 def validate(self):
     super(Gmail, self).validate()
     self.uiauto_params['recipient'] = self.recipient
     # Only accept certain image formats
     if os.path.splitext(self.test_image.lower())[1] not in ['.jpg', '.jpeg', '.png']:
         raise ValidationError('{} must be a JPEG or PNG file'.format(self.test_image))