def test_should_raise_exception_when_none_action_executed(self):
     params = self._get_params_for_run_all()
     params['rule_list'] = [{
         'conditions': {
             'all': [{
                 'name': 'this_is_rule_1',
                 'value': True,
                 'operator': 'is_true'
             }]
         },
         'actions': []
     }]
     expected_message = 'No rule executed or no action found in matching rule'
     with self.assertRaisesRegexp(InvalidRuleDefinition, expected_message):
         get_value(**params)
 def test_should_raise_exception_when_more_than_one_action_executed(self):
     params = self._get_params_for_run_all()
     params['rule_list'] = [{
         'conditions': {
             'all': [{
                 'name': 'this_is_rule_2',
                 'value': True,
                 'operator': 'is_false'
             }]
         },
         'actions': [{
             'name': 'some_action_2',
             'params': {
                 'foobar': 'foobarValue'
             }
         }, {
             'name': 'some_action_3'
         }]
     }]
     expected_message = 'Expected only one action to be executed.'
     with self.assertRaisesRegexp(InvalidRuleDefinition, expected_message):
         get_value(**params)
 def test_should_raise_exception_when_none_rule_triggered(self):
     params = self._get_params_for_run_all()
     params['rule_list'] = []
     expected_message = 'No rule executed or no action found in matching rule'
     with self.assertRaisesRegexp(InvalidRuleDefinition, expected_message):
         get_value(**params)
 def test_should_get_value(self):
     result = get_value(**self._get_params_for_run_all())
     expected = 'fooValue'
     self.assertEqual(result, expected)