django-ninja-extra icon indicating copy to clipboard operation
django-ninja-extra copied to clipboard

How to Write or test Post or Put api testcases ?

Open Elixir-MeetThoriya opened this issue 1 year ago • 2 comments

this is my controller

@api_controller("users/", tags=["Users"])
 class UserController(BaseController):
     model = get_user_model()
     @http_post(
         path="",
         response={
             HTTPStatus.CREATED: UserSchema,
             HTTPStatus.INTERNAL_SERVER_ERROR: ErrorSchema,
             HTTPStatus.BAD_REQUEST: ErrorSchema,
         },
         # permissions=[AdminPermission],
         summary="Create Center User",
         description="This endpoint creates a new center user based on the provided data.",
         url_name="create_center_user"
     )
     def create(self, payload: UserInSchema):
         try:

Elixir-MeetThoriya avatar Oct 04 '24 05:10 Elixir-MeetThoriya

@Elixir-MeetThoriya have you tried this https://eadwincode.github.io/django-ninja-extra/tutorial/testing/

eadwinCode avatar Oct 05 '24 22:10 eadwinCode

@Elixir-MeetThoriya Can you close this if the issue is resolved?

eadwinCode avatar Nov 11 '24 14:11 eadwinCode