예제 #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)
예제 #2
0
파일: decorators.py 프로젝트: Aplopio/rip
    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)
예제 #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
예제 #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
예제 #5
0
 def test_should_resolve_read_detail(self):
     assert CrudActions.resolve_action(
         'read_detail') == CrudActions.READ_DETAIL
예제 #6
0
 def test_should_get_aggregates(self):
     assert CrudActions.resolve_action(
         'get_aggregates') == CrudActions.GET_AGGREGATES
예제 #7
0
 def test_should_resolve_delete_detail(self):
     assert CrudActions.resolve_action(
         'delete_detail') == CrudActions.DELETE_DETAIL
예제 #8
0
 def test_should_resolve_update_detail(self):
     assert CrudActions.resolve_action(
         'update_detail') == CrudActions.UPDATE_DETAIL
예제 #9
0
 def test_should_resolve_create_detail(self):
     assert CrudActions.resolve_action(
         'create_detail') == CrudActions.CREATE_DETAIL
예제 #10
0
 def test_should_resolve_read_list(self):
     assert CrudActions.resolve_action(
         'read_list') == CrudActions.READ_LIST
예제 #11
0
 def test_should_resolve_read_detail(self):
     assert CrudActions.resolve_action(
         'read_detail') == CrudActions.READ_DETAIL
예제 #12
0
 def test_should_get_aggregates(self):
     assert CrudActions.resolve_action(
         'get_aggregates') == CrudActions.GET_AGGREGATES
예제 #13
0
 def test_should_resolve_delete_detail(self):
     assert CrudActions.resolve_action(
         'delete_detail') == CrudActions.DELETE_DETAIL
예제 #14
0
 def test_should_resolve_update_detail(self):
     assert CrudActions.resolve_action(
         'update_detail') == CrudActions.UPDATE_DETAIL
예제 #15
0
 def test_should_resolve_create_detail(self):
     assert CrudActions.resolve_action(
         'create_detail') == CrudActions.CREATE_DETAIL
예제 #16
0
 def test_should_resolve_read_list(self):
     assert CrudActions.resolve_action('read_list') == CrudActions.READ_LIST