Пример #1
0
    def to_yaml(cls, dumper, self):
        new_data = common.remove_empty({
            'name': self.name,
            'description': self.description,
            'script': self.script
        })

        return dumper.represent_data(new_data)
Пример #2
0
    def to_yaml(cls, dumper, self):
        new_data = common.remove_empty({
            'name': self.name,
            'description': self.description,
            'steps': self.steps,
            'sla_profile': self.sla_profile
        })

        return dumper.represent_data(new_data)
Пример #3
0
    def to_yaml(cls, dumper, self):
        #logging.debug(cls.yaml_flow_style)
        new_data = common.remove_empty(
            ordereddict({
                'name': self.name,
                'description': self.description,
            }))
        for key in ['init', 'actions', 'end']:
            if len(self.__dict__[key].steps) > 0:
                new_data[key] = self.__dict__[key]

        return dumper.represent_data(new_data)
Пример #4
0
    def to_yaml(cls, dumper, self):
        new_data = {
            'javascript':
            common.remove_empty({
                'name': self.name,
                'description': self.description,
                'script': self.script,
                'change_policy': self.change_policy
            })
        }

        return dumper.represent_data(new_data)
Пример #5
0
 def provide_inner_data(self):
     ret = {
         'rampup_load':
         common.remove_empty(
             ordereddict({
                 'min_users': 1,
                 'max_users': self.to,
                 'increment_users': self.by,
                 'increment_every': self.per,
                 'duration': self.duration
             }))
     }
     return ret
Пример #6
0
    def to_yaml(cls, dumper, self):
        new_data = {
            'transaction':
            common.remove_empty({
                'name':
                self.name,
                'description':
                self.description,
                'steps':
                self.steps,
                'sla_profile':
                self.sla_profile if 'sla_profile' in self.__dict__ else None
            })
        }

        return dumper.represent_data(new_data)
Пример #7
0
    def to_yaml(cls, dumper, self):
        new_data = {'name': self.details['name']}
        self.add_default(new_data, 'jsonpath', None)
        self.add_default(new_data, 'xpath', None)
        self.add_default(new_data, 'regexp', None)
        self.add_default(new_data, 'from', 'body')
        self.add_default(new_data, 'match_number', 1)
        self.add_default(new_data, 'template', '$1$')
        self.add_default(new_data, 'decode', None)
        self.add_default(new_data, 'extract_once', False)
        self.add_default(new_data, 'default', None)
        self.add_default(new_data, 'throw_assertion_error', True)

        new_data = common.remove_empty(new_data)

        return dumper.represent_data(new_data)
Пример #8
0
    def to_yaml(cls, dumper, self):
        #logging.debug(cls.yaml_flow_style)
        scn_data = common.remove_empty(
            ordereddict({
                'name': self.name,
                'description': self.description,
                'populations': []
            }))
        for pop in self.populations:
            var_pol = pop['variation_policy']
            pop_data = {
                'name': pop['population'].name,
            }
            pop_data.update(var_pol.provide_inner_data())
            scn_data['populations'].append(pop_data)

        return dumper.represent_data(scn_data)
Пример #9
0
    def to_yaml(cls, dumper, self):
        new_data = {
            'request':
            common.remove_empty({
                'url':
                self.details['url'],
                'method':
                self.details['method']
                if self.details['method'] != "GET" else None,
                'body':
                self.details['body'],
                'description':
                self.details['description']
                if 'description' in self.details else None,
                'headers':
                self.headers if len(self.headers) > 0 else None,
                'extractors':
                self.extractors if len(self.extractors) > 0 else None,
                'sla_profile':
                self.sla_profile if 'sla_profile' in self.__dict__ else None
            })
        }

        return dumper.represent_data(new_data)
Пример #10
0
    def to_yaml(cls,dumper,self):
        #logging.debug(cls.yaml_flow_style)
        data = common.remove_empty(ordereddict(self.__dict__))

        return dumper.represent_data(data)