Ejemplo n.º 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
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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
Ejemplo n.º 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)
Ejemplo n.º 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)