https://github.com/davipythonweb/flix-api
API de filmes com Django e DRF
https://github.com/davipythonweb/flix-api
django-framework django-rest-framework pytest pytest-watch
Last synced: 3 months ago
JSON representation
API de filmes com Django e DRF
- Host: GitHub
- URL: https://github.com/davipythonweb/flix-api
- Owner: davipythonweb
- License: mit
- Created: 2024-06-02T02:48:51.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-07-28T01:43:44.000Z (over 1 year ago)
- Last Synced: 2025-02-12T00:36:17.145Z (about 1 year ago)
- Topics: django-framework, django-rest-framework, pytest, pytest-watch
- Language: Python
- Homepage:
- Size: 75.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# API-Django
flix-api
`ìnicial`
- CRUD de filmes
`django_restframework`
`permissoes admin -> all`
`permissoes user -> safe_methods= GET, HEAD, OPTIONS`
- Autenticação
`djangorestframework-simplejwt`
- comandos Django/bash
`django-admin startproject core .`
`python manage.py migrate`
`python manage.py createsuperuser`
`python manage.py runserver`
`python manage.py startapp `
`python mange.py makemigrations`
`adm controller`
*admsuper
*Adm$50001
`user_teste`
*cinemark
*cines@23
## pytest
`pip install pytest pytest-django`
`pip install pytest-watch`
### usage
- executar scripts powershell
`set-executionpolicy unrestricted`
-runing pytest- rodar no terminal => pytest
- para ver tudo => pytest -rP
- runing unitest- para o test_django => python manage.py test
- com lib pytest-watch => ptw
#### usage in postman
- via GET
`1) gerar um access-token para o usuario no endpoint:localhost/api/v1/authentication/token/ passando no body: {"username": "", "password": ""}`
`2) usar o authorization Bearer token e colocar o access-token gerado com o usuario cadastrado. exemplo de endpoint: localhost/api/v1/genres .Use o method POST para o request. OBS:authorizations para usuario normal=> GET,HEAD,OPTIONS`
`3) para gerar um novo access-token => acesse rota /api/authentication/token/refresh/ passando no body: {"refresh": ""}`
- via POST
`4) para requests: POST,PUT,PATCH,DELETE fazer o mesmo processo , mas com um usuario admin.`