Exemplo n.º 1
0
    def wrapper(self, request):
        action = CrudActions.resolve_action(func.__name__)
        request.context_params['crud_action'] = action

        if not self.is_action_allowed(action):
            return Response(is_success=False,
                            reason=error_types.MethodNotAllowed)
        return func(self, request=request)
Exemplo n.º 2
0
    def wrapper(self, request):
        action = CrudActions.resolve_action(func.__name__)
        request.context_params['crud_action'] = action

        if not self.is_action_allowed(action):
            return Response(
                is_success=False, reason=error_types.MethodNotAllowed)
        return func(self, request=request)
Exemplo n.º 3
0
    def test_should_get_all_actions(self):
        all_actions = CrudActions.get_all_actions()

        assert len(all_actions) == 7
        assert CrudActions.READ_DETAIL in all_actions
        assert CrudActions.READ_LIST in all_actions
        assert CrudActions.CREATE_DETAIL in all_actions
        assert CrudActions.UPDATE_DETAIL in all_actions
        assert CrudActions.CREATE_OR_UPDATE_DETAIL in all_actions
        assert CrudActions.DELETE_DETAIL in all_actions
        assert CrudActions.GET_AGGREGATES in all_actions
Exemplo n.º 4
0
    def test_should_get_all_actions(self):
        all_actions = CrudActions.get_all_actions()

        assert len(all_actions) == 7
        assert CrudActions.READ_DETAIL in all_actions
        assert CrudActions.READ_LIST in all_actions
        assert CrudActions.CREATE_DETAIL in all_actions
        assert CrudActions.UPDATE_DETAIL in all_actions
        assert CrudActions.CREATE_OR_UPDATE_DETAIL in all_actions
        assert CrudActions.DELETE_DETAIL in all_actions
        assert CrudActions.GET_AGGREGATES in all_actions
Exemplo n.º 5
0
 def test_should_resolve_read_detail(self):
     assert CrudActions.resolve_action(
         'read_detail') == CrudActions.READ_DETAIL
Exemplo n.º 6
0
 def test_should_get_aggregates(self):
     assert CrudActions.resolve_action(
         'get_aggregates') == CrudActions.GET_AGGREGATES
Exemplo n.º 7
0
 def test_should_resolve_delete_detail(self):
     assert CrudActions.resolve_action(
         'delete_detail') == CrudActions.DELETE_DETAIL
Exemplo n.º 8
0
 def test_should_resolve_update_detail(self):
     assert CrudActions.resolve_action(
         'update_detail') == CrudActions.UPDATE_DETAIL
Exemplo n.º 9
0
 def test_should_resolve_create_detail(self):
     assert CrudActions.resolve_action(
         'create_detail') == CrudActions.CREATE_DETAIL
Exemplo n.º 10
0
 def test_should_resolve_read_list(self):
     assert CrudActions.resolve_action(
         'read_list') == CrudActions.READ_LIST
Exemplo n.º 11
0
 def test_should_resolve_read_detail(self):
     assert CrudActions.resolve_action(
         'read_detail') == CrudActions.READ_DETAIL
Exemplo n.º 12
0
 def test_should_get_aggregates(self):
     assert CrudActions.resolve_action(
         'get_aggregates') == CrudActions.GET_AGGREGATES
Exemplo n.º 13
0
 def test_should_resolve_delete_detail(self):
     assert CrudActions.resolve_action(
         'delete_detail') == CrudActions.DELETE_DETAIL
Exemplo n.º 14
0
 def test_should_resolve_update_detail(self):
     assert CrudActions.resolve_action(
         'update_detail') == CrudActions.UPDATE_DETAIL
Exemplo n.º 15
0
 def test_should_resolve_create_detail(self):
     assert CrudActions.resolve_action(
         'create_detail') == CrudActions.CREATE_DETAIL
Exemplo n.º 16
0
 def test_should_resolve_read_list(self):
     assert CrudActions.resolve_action('read_list') == CrudActions.READ_LIST