Exemplo n.º 1
0
 def init_on_load(self):
     """Loads all necessary fields upon Condition being loaded from database"""
     if not self.errors:
         self._data_param_name, self._run, self._api = get_condition_api(
             self.app_name, self.action_name)
         self._condition_executable = get_condition(self.app_name,
                                                    self._run)
Exemplo n.º 2
0
 def init_on_load(self):
     """Loads all necessary fields upon Condition being loaded from database"""
     if not self.errors:
         errors = []
         try:
             self._data_param_name, run, self._api = get_condition_api(self.app_name, self.action_name)
             get_condition(self.app_name, run)
         except UnknownApp:
             errors.append('Unknown app {}'.format(self.app_name))
         except UnknownCondition:
             errors.append('Unknown condition {}'.format(self.action_name))
         self.errors = errors
Exemplo n.º 3
0
 def validate(self):
     """Validates the object"""
     errors = []
     try:
         self._data_param_name, run, self._api = get_condition_api(self.app_name, self.action_name)
         self._condition_executable = get_condition(self.app_name, run)
         tmp_api = split_api_params(self._api, self._data_param_name)
         validate_condition_parameters(tmp_api, self.arguments, self.action_name)
     except UnknownApp:
         errors.append('Unknown app {}'.format(self.app_name))
     except UnknownCondition:
         errors.append('Unknown condition {}'.format(self.action_name))
     except InvalidArgument as e:
         errors.extend(e.errors)
     self.errors = errors
Exemplo n.º 4
0
 def test_get_flag_api_invalid(self):
     with self.assertRaises(UnknownCondition):
         get_condition_api('HelloWorld', 'invalid')
Exemplo n.º 5
0
 def test_get_flag_api_invalid(self):
     with self.assertRaises(UnknownCondition):
         get_condition_api('HelloWorld', 'invalid')