Beispiel #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)
Beispiel #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)
Beispiel #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
Beispiel #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
Beispiel #5
0
 def test_should_resolve_read_detail(self):
     assert CrudActions.resolve_action(
         'read_detail') == CrudActions.READ_DETAIL
Beispiel #6
0
 def test_should_get_aggregates(self):
     assert CrudActions.resolve_action(
         'get_aggregates') == CrudActions.GET_AGGREGATES
Beispiel #7
0
 def test_should_resolve_delete_detail(self):
     assert CrudActions.resolve_action(
         'delete_detail') == CrudActions.DELETE_DETAIL
Beispiel #8
0
 def test_should_resolve_update_detail(self):
     assert CrudActions.resolve_action(
         'update_detail') == CrudActions.UPDATE_DETAIL
Beispiel #9
0
 def test_should_resolve_create_detail(self):
     assert CrudActions.resolve_action(
         'create_detail') == CrudActions.CREATE_DETAIL
Beispiel #10
0
 def test_should_resolve_read_list(self):
     assert CrudActions.resolve_action(
         'read_list') == CrudActions.READ_LIST
Beispiel #11
0
 def test_should_resolve_read_detail(self):
     assert CrudActions.resolve_action(
         'read_detail') == CrudActions.READ_DETAIL
Beispiel #12
0
 def test_should_get_aggregates(self):
     assert CrudActions.resolve_action(
         'get_aggregates') == CrudActions.GET_AGGREGATES
Beispiel #13
0
 def test_should_resolve_delete_detail(self):
     assert CrudActions.resolve_action(
         'delete_detail') == CrudActions.DELETE_DETAIL
Beispiel #14
0
 def test_should_resolve_update_detail(self):
     assert CrudActions.resolve_action(
         'update_detail') == CrudActions.UPDATE_DETAIL
Beispiel #15
0
 def test_should_resolve_create_detail(self):
     assert CrudActions.resolve_action(
         'create_detail') == CrudActions.CREATE_DETAIL
Beispiel #16
0
 def test_should_resolve_read_list(self):
     assert CrudActions.resolve_action('read_list') == CrudActions.READ_LIST