Exemple #1
0
def api_rule(uuid):
    if flask.request.method == 'GET':
        rule = rules.get(uuid)
        return flask.jsonify(rule_repr(rule, short=False))
    else:
        rules.delete(uuid)
        return '', 204
Exemple #2
0
def api_rule(uuid):
    if flask.request.method == 'GET':
        rule = rules.get(uuid)
        return flask.jsonify(rule_repr(rule, short=False))
    else:
        rules.delete(uuid)
        return _generate_empty_response(204)
Exemple #3
0
    def test_get(self):
        rule_json = rules.get(self.uuid).as_dict()

        self.assertTrue(rule_json.pop(self.uuid))
        self.assertEqual({'description': None,
                          'conditions': self.conditions_json,
                          'actions': self.actions_json},
                         rule_json)
Exemple #4
0
def api_rule(uuid):
    utils.check_auth(flask.request)

    if flask.request.method == 'GET':
        rule = rules.get(uuid)
        return flask.jsonify(rule_repr(rule, short=False))
    else:
        rules.delete(uuid)
        return '', 204
Exemple #5
0
    def test_get(self):
        rule_json = rules.get(self.uuid).as_dict()

        self.assertTrue(rule_json.pop('uuid'))
        self.assertEqual(
            {
                'description': None,
                'conditions': self.conditions_json,
                'actions': self.actions_json
            }, rule_json)
Exemple #6
0
    def test_get(self):
        rule_json = rules.get(self.uuid).as_dict()

        self.assertTrue(rule_json.pop('uuid'))
        self.assertEqual(
            {
                'description':
                None,
                'conditions': [
                    BaseTest.condition_defaults(cond)
                    for cond in self.conditions_json
                ],
                'actions':
                self.actions_json
            }, rule_json)