From 0985be632928341d6dcd87ae294ba33eb86760e0 Mon Sep 17 00:00:00 2001 From: matheus-dev-fullstack Date: Sun, 12 May 2024 15:14:06 -0300 Subject: [PATCH 01/19] feat: add github-actions demo --- .github/workflows/github-actions-demo.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/workflows/github-actions-demo.yml diff --git a/.github/workflows/github-actions-demo.yml b/.github/workflows/github-actions-demo.yml new file mode 100644 index 0000000..deddd0b --- /dev/null +++ b/.github/workflows/github-actions-demo.yml @@ -0,0 +1,17 @@ +name: GitHub Actions Demo +on: [push] +jobs: + Explore-GitHub-Actions: + runs-on: ubuntu-latest + steps: + - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." + - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" + - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." + - name: Check out repository code + uses: actions/checkout@v4 + - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." + - run: echo "🖥️ The workflow is now ready to test your code on the runner." + - name: List files in the repository + run: | + ls ${{ github.workspace }} + - run: echo "🍏 This job's status is ${{ job.status }}." \ No newline at end of file From 6ca601a87e982f7d73c1809188ed7d19ccf40218 Mon Sep 17 00:00:00 2001 From: matheus-dev-fullstack Date: Sun, 12 May 2024 15:42:01 -0300 Subject: [PATCH 02/19] =?UTF-8?q?Removendo=20autentica=C3=A7=C3=B5es=20des?= =?UTF-8?q?necess=C3=A1rias?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- product/viewsets/product_viewset.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/product/viewsets/product_viewset.py b/product/viewsets/product_viewset.py index 218cc96..505d1e1 100644 --- a/product/viewsets/product_viewset.py +++ b/product/viewsets/product_viewset.py @@ -1,9 +1,4 @@ from rest_framework.viewsets import ModelViewSet -from rest_framework.authentication import ( - SessionAuthentication, - BasicAuthentication, - TokenAuthentication, -) from rest_framework.permissions import IsAuthenticated @@ -12,11 +7,6 @@ class ProductViewSet(ModelViewSet): - authentication_classes = [ - SessionAuthentication, - BasicAuthentication, - TokenAuthentication, - ] permission_classes = [IsAuthenticated] serializer_class = ProductSerializer From 51f4f957c1361ecf3085364a959c038b9b262507 Mon Sep 17 00:00:00 2001 From: matheus-dev-fullstack Date: Sun, 12 May 2024 15:42:29 -0300 Subject: [PATCH 03/19] =?UTF-8?q?Atualizando=20credenciais=20e=20renomeand?= =?UTF-8?q?o=20vari=C3=A1veis?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker-compose.yml | 28 +++++++++++----------------- env.dev | 6 +++--- 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 66640b1..1309f30 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,33 +1,27 @@ version: '3.9' services: + db: + image: postgres:13.0-alpine + ports: + - 5432:5432 + volumes: + - postgres_data:/var/lib/postgresql/data/ + environment: + - POSTGRES_USER=bookstore_dev + - POSTGRES_PASSWORD=bookstore_dev + - POSTGRES_DB=bookstore_dev_db web: build: . command: python manage.py runserver 0.0.0.0:8000 volumes: - - .:/usr/src/app + - . :/usr/src/app/ ports: - 8000:8000 env_file: - ./env.dev - networks: - - backend depends_on: - db - db: - image: postgres:13.0-alpine - volumes: - - postgres_data:/var/lib/postgresql/data - environment: - - POSTGRES_USER=dev - - POSTGRES_PASSWORD=dev - - POSTGRES_DB=bookstore_db - networks: - - backend - -networks: - backend: - driver: bridge volumes: postgres_data: \ No newline at end of file diff --git a/env.dev b/env.dev index fca16a0..491c2f0 100644 --- a/env.dev +++ b/env.dev @@ -2,8 +2,8 @@ DEBUG=1 SECRET_KEY=foo DJANGO_ALLOWED_HOSTS=localhost 127.0.0.1 [::1] SQL_ENGINE=django.db.backends.postgresql -SQL_DATABASE=bookstore_db -SQL_USER=dev -SQL_PASSWORD=dev +SQL_DATABASE=bookstore_dev_db +SQL_USER=bookstore_dev +SQL_PASSWORD=bookstore_dev SQL_HOST=db SQL_PORT=5432 \ No newline at end of file From cdd98afc12a7a97134e8f8bc53c3a1289e25bcc7 Mon Sep 17 00:00:00 2001 From: matheus-dev-fullstack Date: Tue, 14 May 2024 19:17:33 -0300 Subject: [PATCH 04/19] Revisando test_viewsets --- .../__pycache__/__init__.cpython-312.pyc | Bin 167 -> 167 bytes .../__pycache__/settings.cpython-312.pyc | Bin 3068 -> 3752 bytes bookstore/__pycache__/urls.cpython-312.pyc | Bin 1477 -> 1477 bytes bookstore/__pycache__/wsgi.cpython-312.pyc | Bin 659 -> 659 bytes bookstore/settings.py | 39 +++++++++--------- db.sqlite3 | Bin 200704 -> 200704 bytes docker-compose.yml | 2 +- order/__pycache__/__init__.cpython-312.pyc | Bin 163 -> 163 bytes order/__pycache__/admin.cpython-312.pyc | Bin 251 -> 251 bytes order/__pycache__/apps.cpython-312.pyc | Bin 467 -> 467 bytes order/__pycache__/factories.cpython-312.pyc | Bin 1747 -> 1747 bytes order/__pycache__/urls.cpython-312.pyc | Bin 604 -> 604 bytes .../__pycache__/0001_initial.cpython-312.pyc | Bin 1400 -> 1400 bytes .../0002_alter_order_user.cpython-312.pyc | Bin 1134 -> 1134 bytes .../0003_alter_order_user.cpython-312.pyc | Bin 1118 -> 1118 bytes .../__pycache__/__init__.cpython-312.pyc | Bin 174 -> 174 bytes .../__pycache__/__init__.cpython-312.pyc | Bin 208 -> 208 bytes .../models/__pycache__/order.cpython-312.pyc | Bin 758 -> 758 bytes .../__pycache__/__init__.cpython-312.pyc | Bin 234 -> 234 bytes .../order_serializer.cpython-312.pyc | Bin 2147 -> 2150 bytes .../__pycache__/__init__.cpython-312.pyc | Bin 169 -> 169 bytes .../__pycache__/__init__.cpython-312.pyc | Bin 183 -> 183 bytes ...order_viewset.cpython-312-pytest-8.0.2.pyc | Bin 0 -> 3565 bytes .../test_order_viewset.cpython-312.pyc | Bin 3437 -> 3452 bytes .../__pycache__/__init__.cpython-312.pyc | Bin 225 -> 225 bytes .../__pycache__/order_viewset.cpython-312.pyc | Bin 651 -> 651 bytes product/__pycache__/__init__.cpython-312.pyc | Bin 165 -> 165 bytes product/__pycache__/admin.cpython-312.pyc | Bin 277 -> 277 bytes product/__pycache__/apps.cpython-312.pyc | Bin 473 -> 473 bytes product/__pycache__/factories.cpython-312.pyc | Bin 1865 -> 1939 bytes product/__pycache__/urls.cpython-312.pyc | Bin 610 -> 610 bytes product/factories.py | 1 + .../__pycache__/0001_initial.cpython-312.pyc | Bin 1777 -> 1777 bytes .../__pycache__/__init__.cpython-312.pyc | Bin 176 -> 176 bytes .../__pycache__/__init__.cpython-312.pyc | Bin 256 -> 256 bytes .../__pycache__/category.cpython-312.pyc | Bin 951 -> 951 bytes .../__pycache__/product.cpython-312.pyc | Bin 967 -> 967 bytes .../__pycache__/__init__.cpython-312.pyc | Bin 303 -> 303 bytes .../category_serializer.cpython-312.pyc | Bin 770 -> 770 bytes .../product_serializer.cpython-312.pyc | Bin 1626 -> 1627 bytes .../__pycache__/__init__.cpython-312.pyc | Bin 171 -> 171 bytes .../__pycache__/__init__.cpython-312.pyc | Bin 186 -> 186 bytes ...oduct_viewset.cpython-312-pytest-8.0.2.pyc | Bin 0 -> 3271 bytes .../test_product_viewset.cpython-312.pyc | Bin 3166 -> 4069 bytes .../tests_viewsets/test_product_viewset.py | 19 ++++++--- .../__pycache__/__init__.cpython-312.pyc | Bin 231 -> 231 bytes .../product_viewset.cpython-312.pyc | Bin 1122 -> 974 bytes product/viewsets/product_viewset.py | 2 +- 48 files changed, 37 insertions(+), 26 deletions(-) create mode 100644 order/tests/test_viewsets/__pycache__/test_order_viewset.cpython-312-pytest-8.0.2.pyc create mode 100644 product/tests/tests_viewsets/__pycache__/test_product_viewset.cpython-312-pytest-8.0.2.pyc diff --git a/bookstore/__pycache__/__init__.cpython-312.pyc b/bookstore/__pycache__/__init__.cpython-312.pyc index 3bf304576581b3e57ab35ef2309fe13118840155..b6a423e1159d937e8c081d059ef3d21b0de897da 100644 GIT binary patch delta 20 acmZ3^xSWyaG%qg~0}$N#Yn?WcXEp#hl?DC) delta 20 acmZ3^xSWyaG%qg~0}#w`d6hbmXEp#e$_1|g diff --git a/bookstore/__pycache__/settings.cpython-312.pyc b/bookstore/__pycache__/settings.cpython-312.pyc index a05475ab4fa1a77eb6aba927500ac29ae19b4d30..196472f42e80e6d130e222544f39becc3da18e50 100644 GIT binary patch delta 1411 zcmbVM&1)M+6rb5$ee7zb$g*O~vQ;OolUhzBHFg|_mYPVls#Z~C*HS3#MM!!pdG)pK zuGA!gM(QnrLJ)h94?YCvVn`1KAKL$+5K?q83oV5}q0oce^jK(TrK)ylq0|HO-kUe? z_j?~Z?C+ENzVx?tJBP?pzm61s8$;-YaTu+^4LQ90fDHJjFv;$<|3sxA+mqu`d0KPp|+ZSc?cudstwJHWST(MX-V4Wq~8owudDQ{4P_( z0uOe<4h|8QW{#OhR%v!*wMGU)a0Z-DN&Uw9FW4~3kT51%z}2)NbPDV^wA`nForQ^0 zpeDidPt=M25jq~riT4dm=Vo|ABq5ys%W;DXnMabN{E z*=Na~fH#Cmm=ip30WOly^yVIh`CVF=0)O!q7QEzHO#hF8F981X(x{}-V-jZWQU1$X z5QAwcxEQ>yb#a0wmi7~tT11Bwu@F+ldR?j&)e!fy(O}Y#b!H=5-)csnl&uxzfK*e( zd_xffg@y8scbAuP`Q`KKmRPtFxOV4KbuLi!m(}fDwo+db)I`ZpglU|8zI{3vB$3ES(7LDAF`LW_4 zBlr7sOC|$yK9kWYS=A!!4Q+>w*)3x2Q%R9)I$ad&+7E2pY9%Q$i7Rhu7r7Xx(-Il! z93jxEoG|+yF^r#x`h>_njWIr=ILy5CAk2M_JlYFxp8D0TP1#~CcXy$)&<%Eik7u5T zZuVS>L#M0Db-1phScGGJ+)3*M|+S}$nj~t#h*XPj0@^j?sTeU-* mZ?4TB@rdOgL>|Q-#vdggCU;i$!w-@@KG?H{J~t_0(&?W_mp;e< delta 673 zcmY*WO-~b16n$?#+v&_OEtDxp0Yj^{CT*pXKmrLE8a`6X0*uL9*jVm#QYf~}6oGE2 zzu_&^gpFO9VBB=$e{iEa)3`8kLm2P>Bv2=#~Tn%>Y7R zoN^UR1|SF_<_f}KABXxFu3%dr1`KCN5KIzcfrIP~L4<^1gbc$dTwwuYZ4A*1lN^vg_X5Jt}7Il z?&ch$^U)W@SnmAvuVb~480pHzBGk5vMOq3hhQ;OFoqH=?Z7HAMxSv}tu5N5@ZPFKk zRr({aM%UFGeXf$RTkN3TU%OKbJsx9x&M8><9zl47hO`^HCn3Mq5p7RRsh9 delta 20 acmX@geUzK~G%qg~0}$95D{SQ6#R>p5ECiN{G%qg~0}$N#Yn`@{r=1A^JY@y! delta 21 bcmbQtI+>N{G%qg~0}w28d6l}6r=1A^IlBd` diff --git a/bookstore/settings.py b/bookstore/settings.py index 1cec9c8..edf8831 100644 --- a/bookstore/settings.py +++ b/bookstore/settings.py @@ -1,13 +1,13 @@ """ Django settings for bookstore project. -Generated by 'django-admin startproject' using Django 5.0.3. +Generated by 'django-admin startproject' using Django 3.2.8. For more information on this file, see -https://docs.djangoproject.com/en/5.0/topics/settings/ +https://docs.djangoproject.com/en/3.2/topics/settings/ For the full list of settings and their values, see -https://docs.djangoproject.com/en/5.0/ref/settings/ +https://docs.djangoproject.com/en/3.2/ref/settings/ """ import os @@ -18,15 +18,15 @@ # Quick-start development settings - unsuitable for production -# See https://docs.djangoproject.com/en/5.0/howto/deployment/checklist/ +# See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = "django-insecure-ytvw$u%b^9xle0&yw3*%=$s2zz@spz94k*%*88xr50s$dggo#e" +SECRET_KEY = "django-insecure-f*k@=53bc5!shef1-6w+m$-g)kspbaljz%8k4(j7iuc-u2_dyd" # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = True +# DEBUG = True -ALLOWED_HOSTS = [] +# ALLOWED_HOSTS = [] # Application definition @@ -39,9 +39,9 @@ "django.contrib.messages", "django.contrib.staticfiles", "django_extensions", - "rest_framework", "order", "product", + "rest_framework", "debug_toolbar", "rest_framework.authtoken", ] @@ -79,7 +79,7 @@ # Database -# https://docs.djangoproject.com/en/5.0/ref/settings/#databases +# https://docs.djangoproject.com/en/3.2/ref/settings/#databases DATABASES = { "default": { @@ -92,9 +92,8 @@ } } - # Password validation -# https://docs.djangoproject.com/en/5.0/ref/settings/#auth-password-validators +# https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators AUTH_PASSWORD_VALIDATORS = [ { @@ -113,7 +112,7 @@ # Internationalization -# https://docs.djangoproject.com/en/5.0/topics/i18n/ +# https://docs.djangoproject.com/en/3.2/topics/i18n/ LANGUAGE_CODE = "en-us" @@ -121,19 +120,22 @@ USE_I18N = True +USE_L10N = True + USE_TZ = True # Static files (CSS, JavaScript, Images) -# https://docs.djangoproject.com/en/5.0/howto/static-files/ +# https://docs.djangoproject.com/en/3.2/howto/static-files/ -STATIC_URL = "static/" +STATIC_URL = "/static/" # Default primary key field type -# https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field +# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField" + REST_FRAMEWORK = { "DEFAULT_PAGINATION_CLASS": "rest_framework.pagination.PageNumberPagination", "PAGE_SIZE": 5, @@ -148,11 +150,10 @@ "127.0.0.1", ] -SECRET_KEY = os.environ.get("SECRET_KEY") +# SECRET_KEY = os.environ.get("SECRET_KEY") DEBUG = int(os.environ.get("DEBUG", default=0)) -# 'DJANGO_ALLOWED_HOSTS' should be a single string os hosts with a space between each. +# 'DJANGO_ALLOWED_HOSTS' should be a single string of hosts with a space between each. # For example: 'DJANGO_ALLOWED_HOSTS=localhost 127.0.0.1 [::1]' - -ALLOWED_HOSTS = os.environ.get("DJANGO_ALLOWED_HOSTS").split(" ") +# ALLOWED_HOSTS = os.environ.get("DJANGO_ALLOWED_HOSTS").split(" ") \ No newline at end of file diff --git a/db.sqlite3 b/db.sqlite3 index c4e3cf4566fbe4520c56b126d9581e3db3fc8bbd..92faf2162c477e80b6cfcd9962193397e898dfcf 100644 GIT binary patch delta 123 zcmZozz|*jRXM!|i(nJ|&#-xo2OZb_kIBO@f3m7wT)^2tbaO8A%m11R(cXv!IEy*a! z&rZ!VFfcHQPs}MvEs6*83ySh9D&zADN;32Fij546Omq!Qbq$RajEt;|EUZjS^~^2J Y4NQzSACa^cW0Yz#Xft43X2A3S0QaRNo&W#< delta 48 zcmZozz|*jRXM!|i;zSu|#>9;YOZb^3Igd*!zebve7fC4yX(Rx7llo}G5`gN1c3$v E0Kr!rQ2+n{ delta 102 zcmcc2dzqK_G%qg~0}vcKDV26>BX2wtBhTbqrVK`o&DWR~GcpQIu4385C^cD^wVIKC z@=DfU1}vrK?VE@XUB$oLBbP~Zz652M%w^XYaI?XC-(Tog9>$^aB75(F9y E00)&F7ytkO diff --git a/order/__pycache__/urls.cpython-312.pyc b/order/__pycache__/urls.cpython-312.pyc index a3aeef2b83658e4495f8cb06b19d0382a07334a9..12fdf8a475794888a3eb555c5a4aa1f280c1b6c9 100644 GIT binary patch delta 26 gcmcb^a)*WcG%qg~0}zBo+iv9k&&YUxGB;Bo0Ab1pHUIzs delta 26 gcmcb^a)*WcG%qg~0}vcKDYcRNKO^Jw$=pnV0BaQo^#A|> diff --git a/order/migrations/__pycache__/0001_initial.cpython-312.pyc b/order/migrations/__pycache__/0001_initial.cpython-312.pyc index 6f1b0bf3efd58f30f998d065d01f07373877b8af..09e564ad75af6e5cc23e45355c53a0d7f079a2c3 100644 GIT binary patch delta 20 acmeyt^@EH1G%qg~0}#0Wv);&^%L)KNdIhTh delta 20 acmeyt^@EH1G%qg~0}vcKDYcP1mlXg*0tM0l diff --git a/order/migrations/__pycache__/0002_alter_order_user.cpython-312.pyc b/order/migrations/__pycache__/0002_alter_order_user.cpython-312.pyc index 7ad733534558d7204635cf37bea66a06f38e5e0d..5ae9aae75909eafc98463e2bb250ead93d00b4f5 100644 GIT binary patch delta 20 acmaFI@s5N0G%qg~0}#0Wv);&^%mM&Ep#_Kl delta 20 acmaFI@s5N0G%qg~0}vcKDYcP1nFRnrDFv?p diff --git a/order/migrations/__pycache__/0003_alter_order_user.cpython-312.pyc b/order/migrations/__pycache__/0003_alter_order_user.cpython-312.pyc index 20f5fc7b667b8600f864beb11b84db04e68bd354..c4771470ef6fa67eb52df2940af607ac966ce0fa 100644 GIT binary patch delta 20 acmcb|agT%hG%qg~0}#0Wv);%Z%mM&CAq7|f delta 20 acmcb|agT%hG%qg~0}vcKDYcP1m<0ensRe%k diff --git a/order/migrations/__pycache__/__init__.cpython-312.pyc b/order/migrations/__pycache__/__init__.cpython-312.pyc index 9e6156fdfbee01804131627250ef1b22cb5a04f3..01387716dacb55c0e7dbaf50b4e598f521adc4a2 100644 GIT binary patch delta 20 acmZ3-xQ>zMG%qg~0}$N#Yn?WcXAuB7rUnxL delta 20 acmZ3-xQ>zMG%qg~0}v<&yh)wNvj_k)`UPD8 diff --git a/order/models/__pycache__/__init__.cpython-312.pyc b/order/models/__pycache__/__init__.cpython-312.pyc index 7e5d4106a82279b4d0f9c880c9b6d4080b130029..de95e3152013a5c5c4feee1ed60a09e001aa7037 100644 GIT binary patch delta 21 bcmcb>c!81kG%qg~0}zBo+onlQc!81kG%qg~0}vcKDU~KMk@qkFL0kqS diff --git a/order/models/__pycache__/order.cpython-312.pyc b/order/models/__pycache__/order.cpython-312.pyc index a00174f59b8fd0cc71add066948878c1a892dc86..586b1d48ed8fdb5aebb45b33a92b8cf40b934f72 100644 GIT binary patch delta 49 zcmeyy`i+(MG%qg~0}zBo+olO_359=PLt{StJZp0{|&u B3n>5q delta 49 zcmeyy`i+(MG%qg~0}vcKDV4^%k(ZH)k##aZ(`6ABCPv#1w|<{apRWu+W|1&Z4FEzj B3)uhw diff --git a/order/serializers/__pycache__/__init__.cpython-312.pyc b/order/serializers/__pycache__/__init__.cpython-312.pyc index ac7c6b1b13546e19325d61c74c6f694131e36558..add5d28acb988ead60d227d0504031c06f6380c1 100644 GIT binary patch delta 21 bcmaFG_==JDG%qg~0}zBo+otJFk@qeDMcM|2 diff --git a/order/serializers/__pycache__/order_serializer.cpython-312.pyc b/order/serializers/__pycache__/order_serializer.cpython-312.pyc index fd67f364beb127f8126b6437d3c4a9a5d2930868..b81cbd5a7e3e529273a0c361a3cb9aba98d2566c 100644 GIT binary patch delta 113 zcmaDX@JxXBG%qg~0}zBo+ooA;d4JJEMzA!Thvo&~sU}NCbo1Dh}T#QYEQFKD~buq(> OVuoKCfSe*_pa}qsuO0XR delta 110 zcmaDR@K}KNG%qg~0}vcKDV651k=KHmk!Q0Tvo<56z~&;Bt&EJKlQr1>v#|qJ6o*gN zWtWlNk-k5FXa04&z>9W)m+gWtB&1x(&c7m5(BOT8M|W~2`*SfCF-Fk|+1JGkFNzs{ LWdL%Dl!4j-E>t2S diff --git a/order/tests/__pycache__/__init__.cpython-312.pyc b/order/tests/__pycache__/__init__.cpython-312.pyc index a854db1aaa889fc8e9479db0ae0eec248b3a38ee..00655d5b33e9d73f372769fff8e72a3cba911058 100644 GIT binary patch delta 19 ZcmZ3rlRK3D*Sg94{$gCcKg?QkApC2R*aepdt%hMVo=9`O{vL}Ys}cRdAd|~;p6w5qqg2CyKNcm zyyh4*TvpCfy(6Ki_I6-Jwp0#I6;Qq{YO`~|yE;lSlzEdAW7PaLdBI_5}zNH_w4R^w2ftxGF}xYq$(GaI&g&ErA%?=7^gL zSF61txA_Iz7^$w&IT8OKPQ>eC7IgF|qp>Z#ggj^sbeROPidUvN3kZGrYKhJ` zh{8_8bRCKpF(_!n0gAcvqX5Sh(8G$)r~GJ{VYeTdF6(j$)_~+8kG7KXrEJ*N|Xy5jQ(80W@7BtLYt!W4Fc@Pux23ha*el zA7}q^^5M(pSN2?Zlzw$V`czU{QpS@q?`B%r{a$we@|D)egf}v=BK`0mgV{y(mU>5O z1Ae>k!wiFJSnx&U0=D3OjTBCKPV>lFjkkf!z$ZJqYUDd!4s- zJ^~QZ0Yx}$dsLGlxB1-!MFeAA05}#yfS8Nu(dAh93eV$9jaAV#=7jBl)9t|CvrE+N z0917w0I5FTO2bs?!&c3?s<_ne8pr>t+RB zc7TBqtVYllu%3LSU5=XDtQ+`>qnUh)V#^Uc^?BfYQEymv$LGQRUX+Ep?F2|bzl}Th zAz_u@+phcr+T?{(6VsKolmTsC1PS^H3;{iagtZa}k;5*{PnM|x9f%&3 zwS!;-^$sH_`94iLC|QW_ju_&YfAd&&zAD{ryu5z zt|()xeS@pn@2RGWjL@+D2Hl`KQkd|A^h=!H$>6-`5=4OS?2cq|VT?++~?!EWa+VP;sQXb;XJ z!9NG%eVzO*IrR1$*G_*Sh~m*Ndiq6q<2!xg;Xnzu<+HwYu~9MIO3m?=m+MWfBW1OE z6JuWpfFCYWff`q7#f9d+Glh>zFeigDOI3+dc7u8V&Ry*ih2M77rk8`ulK$#s0X3)q z2Vp1iY*}KLn02W=p&mrk0AmT< zuLS$sQ+Q2-pq)St0gnapsWcv>;W#}5bJ*ZIc%RlI9LGJzsQxdJ!U<#m literal 0 HcmV?d00001 diff --git a/order/tests/test_viewsets/__pycache__/test_order_viewset.cpython-312.pyc b/order/tests/test_viewsets/__pycache__/test_order_viewset.cpython-312.pyc index a1fe00220f11263040a7abeddc6b6a740663e4cc..6cf350f198769146da2a5bc848c202d4edd57d58 100644 GIT binary patch delta 456 zcmaDW^+$^LG%qg~0}zBo+oo;Y$ZNoCDg@*eTLXy(hC34KD{`(#Sa-1W@ZJ$uy&)vI zKzIYocHWJ=E9$>6Gf8j(C3wEDF^DN`&Sk#EtRo51YRL%FdP7)zy7ffs>Gl)tmzb}x zIUsq$<$^=t73HAI!oeLJ4>))xSFoGa-{29OP z$9hM|{+OLH*KPeT+WG@6En8<~ol3OpLmd?YI@>9w?|U z=UT`$qvnRR{CxA7<{w#^dHFswvkCx%@dMxF8t#4ae4qf701_<>4|&D9qZ`~lv9PjQ hec}^h<@&54xH*c4nNfhvfYEe9^;ZTURU{2m3jpP-mH7Yw delta 441 zcmew(^;U}aG%qg~0}%A2E2Q~uj$ofucNjL=`s|G2db~6a(qfV+85CAuK-KdZP7o`-%2{(p;Yzm<6~ySUzw~?&032zzYgBNg&a}@Q_!mJG#N`6ALq|)h8}) e);z|~Qv91Ud6*dmSX3EJCscoB08&NLK*azw)SPet diff --git a/order/viewsets/__pycache__/__init__.cpython-312.pyc b/order/viewsets/__pycache__/__init__.cpython-312.pyc index 1ce246db264ad424972ac7b3aa2ca6620fff3160..5d98afe0ed71c4935e2681aa435146de97ba5670 100644 GIT binary patch delta 21 bcmaFJ_>htJG%qg~0}zBo+oowwhtJG%qg~0}vcKDV3%@k@pG!L}3PL diff --git a/order/viewsets/__pycache__/order_viewset.cpython-312.pyc b/order/viewsets/__pycache__/order_viewset.cpython-312.pyc index ca1c3066252e9cc212ed3337eccbe4b29da3a6cd..8fa93d6a15295c5df2b7c06409c43c1f2daa6738 100644 GIT binary patch delta 45 xcmeBX?PldY&CAQh00d#twrM{$^6p|}WS@M3akBs$Go$hZo39K&sz?AR4*&&z3ZMW0 delta 45 xcmeBX?PldY&CAQh00f6lN~L|-$h(V?k!|t`#?1mO%#6wtY`!u8sUiWOJOCSz3s3+6 diff --git a/product/__pycache__/__init__.cpython-312.pyc b/product/__pycache__/__init__.cpython-312.pyc index b6765e97adc345b5834e93da0c0f4b3fac061ea6..c10d7632f1d10cbdabc2037fdb006e586994724f 100644 GIT binary patch delta 20 acmZ3=xRjCSG%qg~0}$N#Yn?WcXC?qRM+Nu* delta 20 acmZ3=xRjCSG%qg~0}z-7yh)wNGZO$a83j}T diff --git a/product/__pycache__/admin.cpython-312.pyc b/product/__pycache__/admin.cpython-312.pyc index f0a496dbb8cda4b755c571f6a38416dfd0568be2..784abddc0752278d4f00a66079810898a1eded60 100644 GIT binary patch delta 22 ccmbQrG?j_>G%qg~0}zBo+ool1G%qg~0}vcKDV3JKk(YxJ06vceWB>pF diff --git a/product/__pycache__/apps.cpython-312.pyc b/product/__pycache__/apps.cpython-312.pyc index e28f29b63f06c9bf12a70db73f11aee37e81de85..20f93da3a46116397b5551c33522148ade0aed62 100644 GIT binary patch delta 21 bcmcb~e3O~yG%qg~0}$N#Yn`@{=PV-tN0bJ+ delta 21 bcmcb~e3O~yG%qg~0}z-6yh+{2bCwYRLCOXe diff --git a/product/__pycache__/factories.cpython-312.pyc b/product/__pycache__/factories.cpython-312.pyc index 8b774ba83718fd9bb750e482e05091e659245476..2663c483b9c097a208c911f70903fbd68fae9d99 100644 GIT binary patch delta 276 zcmX@fH<_RBG%qg~0}$Mr;*_SsypgYyiIHdW45n5_w#jnLRg4=Z&tx`J<^icd1*z<- z86hH3983(U%o77d1X7sbVw|bWSt64I8HFdavM4ZePgZ03&L}!rj&+Ny98gy=JCJB$ zxFI0k$y&q@WETkn2|rDq$?sVeByaKhBvw^AmXs7_CY6??7O{a8$O4JU{A}Wrm_;Vr zvvINs0QtpXll|Dl1o>4u%CGaQT;x|-5PzB9w83L?GTU56?a7Sn5(aGSjFJ=5r{_(~ nyDnyaQOx`c15n_L2tT95gz)Kc6XULnnq3q%`^o?m06PQ#HmN=e delta 289 zcmbQtf0B>yG%qg~0}w2AQ%L*Gw2`lqiIHpa45n5_mdSF=Rg688XEK{j)?pOkXIjk& zQpdm$#g@vP#Wy*SQFyW@ivlC(WG|NQjDnM$Shqw-0i}!CfkX?#4FT~^)*^l&yGRg7 z_-S$#f$S;b1`#|ULI^|%1BqL#1x1<3sYN0nHh)2WaY=l7YF=tlVo7FxUXd(Nbn<^D zQ5BHkMIeF~h>Kl-1ke^9$qx5^-%j5d>X&(x8eAu@Wt;1%1(X80wb&d;d|+l|WW3G5 z_nblJ3llq|6!;><$0#u&e0to(xa*>37e&p!G5`g@E(ZX$ C14L{9 diff --git a/product/__pycache__/urls.cpython-312.pyc b/product/__pycache__/urls.cpython-312.pyc index 3e9755f131117d68ac716b8df1b90fd445a88ef2..72149fd33e3935200607d6e153c4d3f21df0dd92 100644 GIT binary patch delta 26 gcmaFF@`#1|G%qg~0}zBo+iv7$Wn#QPS&%6Z09!u>PXGV_ delta 26 gcmaFF@`#1|G%qg~0}vcKDYcQCm5K5BWI?7t0Az{>4gdfE diff --git a/product/factories.py b/product/factories.py index 031b956..8a6ebef 100644 --- a/product/factories.py +++ b/product/factories.py @@ -15,6 +15,7 @@ class Meta: class ProductFactory(factory.django.DjangoModelFactory): price = factory.Faker("pyint") + category = factory.LazyAttribute(CategoryFactory) title = factory.Faker("pystr") @factory.post_generation diff --git a/product/migrations/__pycache__/0001_initial.cpython-312.pyc b/product/migrations/__pycache__/0001_initial.cpython-312.pyc index 1deb86e319c5a3c4da2ea9b417ec43ace75e6a58..0c23f8bac28508b584a90204fecd406e2012f3ff 100644 GIT binary patch delta 20 acmey!`;nLXG%qg~0}#0Wv);)4j12%m&juX; delta 20 acmey!`;nLXG%qg~0}vcKDYcRN85;mYR|Z4? diff --git a/product/migrations/__pycache__/__init__.cpython-312.pyc b/product/migrations/__pycache__/__init__.cpython-312.pyc index 68f1ef71bd9a0f3d468d3db1d30353e2d5749293..d8cd97661f4b88732857beeee7c1461f4e301229 100644 GIT binary patch delta 20 acmdnMxPg)9G%qg~0}$N#Yn?WcX9)l~^adFK delta 20 acmdnMxPg)9G%qg~0}z-7yh)wNvjhM%#szf% diff --git a/product/models/__pycache__/__init__.cpython-312.pyc b/product/models/__pycache__/__init__.cpython-312.pyc index 97951aac1ce8f3e67cf596826b5a7e40935d9c28..d788b80cd9daa262720b09e5b7ee3624a9bd797f 100644 GIT binary patch delta 21 bcmZo*YGC3$&CAQh00d#twrO?~c|QXHFggV! delta 21 bcmZo*YGC3$&CAQh00f6lN~PIMG%qg~0}zBo+iv8xV`Ai*?8UT%k!A9GrY$0D?2J+!W&JgsHD4Kk%pxJ6 FIsjqX4G{nU delta 53 zcmdnazMY->G%qg~0}vcKDYcQ?j){?TvKP}5M&`-ynYM_quro?^l=ati)_i3EGK++O F>HvM{4a5Kd diff --git a/product/models/__pycache__/product.cpython-312.pyc b/product/models/__pycache__/product.cpython-312.pyc index 55da1ea3def141f22456a10e404e41884ea8e7a3..fb9b858f84e7b7b68bd34512c91a3fbcaf3b8ca0 100644 GIT binary patch delta 50 zcmX@kew>~6G%qg~0}z~_?3C8Ek#|0`^j!v-rwlq@*jO2DI@0=cI&;1<0GUNnKt%wA CjSi0h delta 50 zcmX@kew>~6G%qg~0}vcKDV5f-k#|0`^iu|zrwlq@SXdctI@0=cI&;1<0GUNnKt%wB CIu4Wo diff --git a/product/serializers/__pycache__/__init__.cpython-312.pyc b/product/serializers/__pycache__/__init__.cpython-312.pyc index c7c87f404751e70ee74db958fae5219ceeac005c..06b2c2e977982ec2f9b02bc50ffe49dea3ba04ab 100644 GIT binary patch delta 22 ccmZ3_w4RCgG%qg~0}zBo+ook~06fJ6`~Uy| delta 22 ccmZ3_w4RCgG%qg~0}vcKDV3JCkynWk07C)=u>b%7 diff --git a/product/serializers/__pycache__/category_serializer.cpython-312.pyc b/product/serializers/__pycache__/category_serializer.cpython-312.pyc index 7f6f0faa00d66ff3894d8e6d794a576005f3ec25..98734ab4c01d2c57c56da50d3f9ef71f6ca373df 100644 GIT binary patch delta 57 zcmZo-YhvR)&CAQh00d#twrMsSc|R~RvQPfU7{JIj*`H~y7#jy8*9__Fk|q}=O};V! JIYq)iwE&TU4Q~Jd delta 57 zcmZo-YhvR)&CAQh00f6lN~KwB zA>g7zz;%a^iw+@|9l|aor(eh`x*}5C;QO6rauw@oF&1$~@fqCLC5$gh7=L8|a*AYt F`T+?>A^QLT diff --git a/product/tests/__pycache__/__init__.cpython-312.pyc b/product/tests/__pycache__/__init__.cpython-312.pyc index cec44f84082cdce0b2da6c5f83823d1968b84722..e813dd51749e90032d156fe495b0d6fba26ae23b 100644 GIT binary patch delta 19 ZcmZ3@xSEmsG%qg~0}#0Wv!2Mk001wX1q}cI delta 19 ZcmZ3@xSEmsG%qg~0}vcKDK(LM0RS-l1vCHv diff --git a/product/tests/tests_viewsets/__pycache__/__init__.cpython-312.pyc b/product/tests/tests_viewsets/__pycache__/__init__.cpython-312.pyc index 02608113786c973c1e53fe17e261cf5139ed9b98..aa0b8d851d0bfed97d0161ae145bbb7f32d68b41 100644 GIT binary patch delta 19 ZcmdnRxQmhdG%qg~0}#0Wv!2Mk9sn`N1v&r# delta 19 ZcmdnRxQmhdG%qg~0}vcKDK(LMJpeN(1z`XH diff --git a/product/tests/tests_viewsets/__pycache__/test_product_viewset.cpython-312-pytest-8.0.2.pyc b/product/tests/tests_viewsets/__pycache__/test_product_viewset.cpython-312-pytest-8.0.2.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5961e9082eff4e4df8a5429072a3357409a7b0a2 GIT binary patch literal 3271 zcma)8O>7&-6`o!0lFJ{7l1N*k+*Y)lCLtVA@lW$-C;pKo$7!M(j$9P9fW?|SR!Q%2 z+1Zs05i;O|4+@f^F>;Ut1V|1!IIs@NDd^2X4+)TqSu3DAwc!BCC6~g8+>1|rZ@9~i zY1z#H`)1zEdv9mnyzjmFrl%)CpzZ(Q=(#VWgnW-o&{Ti0`92I*h)GPzA|*-mvK=YQ z60wz%D&dN3MeSHAW@{x)@DVF+CrSx1R;;9*Dy8h6Qjg$OtJhAK(so~|Pw-Kz-ySFp zh;huy*x6E6j3sMZX`4)r6H~iP%s5S7kFq)la?*?bNLD})Lkm1LRF$aR0Iq?poWQc_JBXw-}VjV&q#l@H(_{oVYr zLNB~cy|UyhVW+@{r{0_bvO>JhT3~sJ=$$z)xG}gXQ(lc+_jd*|zUK&8Bn4%<(OYLu zzUEO?WDnKvw+Z08KU?3k1# z#q#SjGbi=E&p)sK;rCpry6`L2atzbuF$5*RhT-LfKVulug$T=_w#KMicWRKOf^F-j z;TbMQXFi{2cxOC|u+m{ex?x!Xk{Zu!ft#%aw}A=w??5h*jm+T6fhz}A4qZ9)>5JE1 zyYceZ=FOvTukV_)O%VgF99lR~nx@ z+Zx^59Nl|saNlw&l>gNy#)l)<2AjD(Yx}=A`1!%szRBjk$#rdNqhs$(~yRe%+g$?i5MnURkoA-KGF zAYm#?au{p?jt;m334l2!t*#b=+f>b{8H2Q<1$LHXGrpP#is8iwSncmp2X-m4RRZuj zfPONJy$%?wTfnD^;n>woX*JpLfby61^cnTKRRJZ) z1>=ZPD31z4ji-E=>fT}l+lN_LJ?P(>_=6H{NQdPHjfyJ}9&IH4^V#wy(~tYop(_lSnJGtC`t#JC%8V`r3&#@8<4<>#0{a z`nPT5cHfJU>{FXW%_f$$d%Yyy^JrR`YK~8>YsY^W-udzPhvTi`vF7mD+8Z~A$8HTD zT26^jqykksPKA8rO8aX4q8Mc|zB1c-L4sPU$)(?)C~p zEQ{M?m=)QxNPY+8Ga}50bjuLJf*`(KjHAosUp?F3J#%U5Cnc&Te(KZI6VhfjtG?9M zLWRO0*UrvYEU!{?dFpU|QSWd$y}pQ-Rcsd$2*4tv7g)uEr)g&jAExcO1SpHUH5l*r zYgzG}cn(9bx8o8s8c#b6iqOxN#PbfHgZQQ^f(xkSiqI3W#WPTAJpCL4CtYyZ`6B*= z;iE;kg(uCbQJZs$^9-~^7&-6`mz`$>pC!iIOGCX(`E0oUJR#vfIRoe-v5%ZD3iI>7rm1ENJdpA+_YP zvnv@Sq@pN%kbxA5kb_*HKy&Cph6O}9#V!ii%_RYP(LxF+Y$YT>ed*1J+>1_qZ-2O! zO&e}|>HvK6-prdfZ{|II^Y(ACSeQWD`OB$mzvT(}2MTWE9A^91z$_ApNQ^>?Ool1? zGCl@npW-jF8P?+c3Retd0v69I!6KjGEuK?C#c(EEjASB~98jXgSSDuiL8YnKoN2ar zUWsSoK5~vop&LXB%i%kId;d&Jg%=|KL_zSG%_CV|o>Xb&Y&NGuXEu#dRhrJ}jw~={ zjM6MA1fCsTX6`sU!rno5 zUT<+Z$tU@j**iX42Az;QQy~I33irlN!~IvA%2e&nsU@ANiXziVTPyz#+&-u0bwxJ0 zGR@~?AxzPN8OT{7pm<2yj0BxCgX-0SoYOU!r!s^d7GpRm-kcePJuvpTsU|DeH1xcC zM;>{50&_r{C}#B!824KzUZ0}lp zf8qUFyI`~nOZsP(+m+RJVXgfwm<&Jccy*(-ccZoQG3W0L&$GXaZi5-JD|Ik5R_gp2 zLIJ6R3RWvPp>bvG3-#3TMjMB}P){RI(@Tjt23EafdP%-nrqJYBak(lm%YHY>7)--P z78`i{L=v(RCk67%a?njg*WR2D>?Pd2ynfbKX!9hO)AzVsq0{BO-nGpTeXl!Oc*W(s z9&95TJk{zR`JdyFU*eOnMhaOpj1)AxpE3htq4(J_&$pMd9(jTF{r|J|=nJgB_9E*5 z8L`pZjM;>cA&N*#*`mA?urRwDW?Iju(_`ZBmGt>b;}Z10V`4?ZDA?G{J-SWwivalY3ZE%IaASVXqq+#dI~>5U)gV zUd$?r3sKbr4FIW;BJQTagm7oY2HX4T4^zoM^?@m$>VpW`^r6~c5=)(IkwLK96WOj|5u9VjpT{D`u*8^ zv$dgdV`%&v{xa=?i)oCtAO4?Xt%sm)2{Gr>>uA{sAtgXsz_&V1!qqr!l92*`sN?vY zUq=wIniQP%@4}}>_+Cd;cNLT{KX7@8mqJn)@IB(%ne|K2<(OL&&ar@cDOcO;XW2&h zsn_wd@ItK9>sa-&Z>YpBH`Q^TdyY?B;dReLmy_xxl=T8OIty3$k*n?X66f9sLjXOS zM=3r?6yG0;Mohk>>M~X~PQ`We9l`G*jTy_?^>bd<#Jp6EoCZ|s)&Ph@!;q;l)6zd@Gd_v$! z5OvO4p+`~aFc7oZE+ZuuEj6q%5m8-CO;}KAYq?6**PaKdyY=wKH25_7j}dj{=w11K z{$AcVa&DDRt@Gy}CVJNr`{()1=EO(Uo7Igy-Aivg_~lpc{q?;E7meunw%-?ry6`bi zLQV6=mtLKjczaOY|^%-4#D?eN9>Ram?ns4?nIaN#c8_E8a@H&6Y17LSF z@D2Z_1)`%uz~n^{pL9_)!=hM(a$P|_DvJ1c+A|c9gZ>1`Fp%5CT5LUW6pLt!VE8r6 zp&R6TmgmCXw?()#v)$Ff9kta_Q)o3?oZ_JWn)QJQd2Xi~3)5z^O5u@yVhXEFGX;;W zE?%SH=5>`$^=GH`53H|@e(+aTH2X^gKWOk{!yUxLGZRlO#pIz_LfaoT5vh;2=&il~BG6f;{tdfEP@Dh& literal 3166 zcmb7GO>ERg6drr+UGGmeKbw$E(l#MbU@aMLi@)mEZ_U4&lVDhhD0x7q$fLb{a&ba_Oa_gkCuHJ+HkcA<)*6-@Ng> z_dN6Fec#MaRaGGZ&-Xtzk9P+M`5im%BRb03G$`{#B`T+rESKc6e3Iv|&+ERdkQ8j) zr;AyC(w_|^19o4~rED-6%!ZO7yD#eDY$O@6b-!MfjV7bE9?+|k)jSy{s&t8{K`prG zEB`lHGZRRJ{=iOxXVv|RrA-)gW=Kg{(6H!9YN%5w%jqXL7Cvoi)a~*t;21C|<+wta zaNo(}qnc^;E2hSR(COFH+N1^E0jf=F)YL%ro0eitnIoz4M9PwPI%|7CnI{@aawH`^=5fUP+!(Ten`8che`$)4=oa2Oz057h3Z3x6Xu_|M3 zjogpqtSM~$|WF=+R`;9 z=4d*lB?O8wnJ@(jq&OKC09VW|WJ54DecZ&~w>{PR4~}7$&9SUveX5NO7^$f&8lc{9U8(5!n)tBa$1UK)C&dyxmARhi-m zrpDF07Gl?VJy)yDh=0M1cvWlyW7UrmZ0cQ4ugz@nbXW6c^)GP)FNqs>qj~Lrjw`(+ zZnGE9)x5ZXhv3N5h*N4EdfK#D0O6iCCK*57eG@=`_MAc|Op0itm~@KyW`3ZX^t6_U zGJndZ3g(;8EQ-6w!iou4um(SyQgjwBlZKo!RE>u1;bWttC*_{Kd*u(`XF|q=Ux~V* zs3r>_C;>JUH_!VS#gb0=Xbin2s+l=s5@^buwyY|aVq$f+wY5>)GggnVl3_x!qU$b_ z@;f)d&1QxT5W@Tp#6?nyHO?Qpa%ld@l_RT>*w-UBjxSqxcK5DC4zKz6`p}&8NFu?i zq7*Mk@r8J?siV-;u{2%m>ML~htw`^#Hnz;?ujH@qDz^6&+I#Lc?wgDJCPf_kSFS5p zTW>TLn!1{lkU*!}p|P6ian;od0a& z{CPgTz*!ZPXOQqVJjkqoE&qnk(4F8^-?u&wVOG$!QH5FFt2jVN1>vp*V73G?W}Jz7O*O)emRz{3L-O`U?_t%x#3Z{rEnz! z!VBgkWM13g23?hNSH>alY_=95)3%AN_GtQ}Y`6vL#gKd>_=BG7N zPOJIw06?eB1juzCq_|#+OhR$Jv;{=IM#<&$G&lhvbRksXj1&-WEaG5Qwq|m0Ik5kc zsHIpwbQ=gJs#DpV$@sKtAE$t7TsRYQhFRtb+J?4UQP{jtddnt=k%Yt~S)Np~nk=)B zEN9_@qoW>?Wn}R32t_>GJ4lfp=`Iv+fVfHQFgEW}gt0AfLrtuuOXQcTEuVjKap6XvVw zrd=y`F|Zh%5SBbnVMXT*dbSgHoZ?l(UIPoO8D(<9=$xY9WuI5k^$vD5+BIBW&)evV zTxzfJsnlD}&^z=fe8WqQiIw-r$8p>Pa`-;k`GD+sK;FDhTJMvszmo71X%BZ`q2+G^ HjUDG7exs~A diff --git a/product/tests/tests_viewsets/test_product_viewset.py b/product/tests/tests_viewsets/test_product_viewset.py index e486ebc..3fce81e 100644 --- a/product/tests/tests_viewsets/test_product_viewset.py +++ b/product/tests/tests_viewsets/test_product_viewset.py @@ -1,6 +1,7 @@ from product.factories import CategoryFactory, ProductFactory from order.factories import UserFactory -from product.models import Product, category +from rest_framework.authtoken.models import Token +from product.models import Product from rest_framework.test import APITestCase, APIClient from django.urls import reverse from rest_framework import status @@ -8,10 +9,11 @@ class TestProductViewSet(APITestCase): - client = APIClient() def setUp(self): + self.client = APIClient() self.user = UserFactory() + self.token = Token.objects.create(user=self.user) self.product = ProductFactory( title="pro controller", @@ -19,22 +21,29 @@ def setUp(self): ) def test_get_all_product(self): + token = Token.objects.get(user__username=self.user.username) + self.client.credentials( + HTTP_AUTHORIZATION="Token " + token.key) response = self.client.get(reverse("product-list", kwargs={"version": "v1"})) self.assertEqual(response.status_code, status.HTTP_200_OK) product_data = json.loads(response.content) - self.assertEqual(product_data[0]["title"], self.product.title) - self.assertEqual(product_data[0]["price"], self.product.price) - self.assertEqual(product_data[0]["active"], self.product.active) + self.assertEqual(product_data["results"][0]["title"], self.product.title) + self.assertEqual(product_data["results"][0]["price"], self.product.price) + self.assertEqual(product_data["results"][0]["active"], self.product.active) def test_create_product(self): + token = Token.objects.get(user__username=self.user.username) + self.client.credentials(HTTP_AUTHORIZATION="Token " + token.key) + category = CategoryFactory() data = json.dumps( {"title": "notebook", "price": 800.00, "categories_id": [category.id]} ) print("Data sent1:", data) + response = self.client.post( reverse("product-list", kwargs={"version": "v1"}), data=data, diff --git a/product/viewsets/__pycache__/__init__.cpython-312.pyc b/product/viewsets/__pycache__/__init__.cpython-312.pyc index 9f51a459406740012f33f6619dbfc2a0bd5e8087..bd4047dd92d894ea9e91e8072d799fcc3a590469 100644 GIT binary patch delta 28 hcmaFP_?(gZG%qg~0}zBo+fL-Z!f}s5yNC_Q1psb*2C@JE delta 28 hcmaFP_?(gZG%qg~0}vcKDK(M%3db`B?IJcH7XW!p2XO!Z diff --git a/product/viewsets/__pycache__/product_viewset.cpython-312.pyc b/product/viewsets/__pycache__/product_viewset.cpython-312.pyc index 0abb20bdd6286b95b45ae4c3b211d0bb9b610406..a4007ca51690afd48758a5816543e23aa5098f22 100644 GIT binary patch delta 584 zcmZ8dO=}cE5UrY?uLQFbgY2pV)F?3{i3Acni4yPw1s7q(Llamg+Z{7YPbPHF5|V@K zVK0K9VTAkzb$^N=8*QAOsBl3GTr+%dmT-Sw&Apfec(Wm0kt@J zfz;*>bs2VmdU*}6jGJBN4OjD*c=tim)BHbU*!?rH2BB3gteAzibhN7Q(zPaUWU3&M z5QU#g#$|nNC-39?`O8}H3XX&F+xF{rKbScPW)6dE{b1oBSopvWgQcFoG&HNKp`X98 z!gevW#bpvJ6{nl^hKQ8nO1fH5Oe!wpNW{B(`lui$b^0U7v)akPfd3c9G*M*@9XPre z_AcD$+2y0kT+co?w9#2UZ87RN7!sAlABn`c=%J}JrF}r5-QrAFvRv@M z#gpFn8w`Jnml6+>M&iMfHlmnOK`?BSDt*a-vyQ!w$f*lA>h=I3Hi&vW17(e#$Tf zYnkwb Date: Sun, 19 May 2024 19:45:15 -0300 Subject: [PATCH 05/19] Configurando build para github actions --- .github/workflows/build.yml | 35 ++++++++++++++++++ .github/workflows/github-actions-demo.yml | 2 +- .../__pycache__/settings.cpython-312.pyc | Bin 3752 -> 4012 bytes bookstore/settings.py | 8 ++-- docker-compose.yml | 2 +- requirements.txt | 8 ++++ 6 files changed, 49 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..4dfaf32 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,35 @@ +on: [push] + +jobs: + build: + strategy: + fail-fast: false + matrix: + python-version: [3.8, 3.9] + poetry-version: [1.1.4] + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Install poetry ${{ matrix.poetry-version }} + run: | + python -m ensurepip + python -m pip install --upgrade pip + python -m pip install poetry==${{ matrix.poetry-version }} + - name: View poetry --help + run: poetry --help + + - name: Install dependencies + shell: bash + run: python -m poetry install + + - name: Test + run: | + poetry run python manage.py test \ No newline at end of file diff --git a/.github/workflows/github-actions-demo.yml b/.github/workflows/github-actions-demo.yml index deddd0b..2af4ce3 100644 --- a/.github/workflows/github-actions-demo.yml +++ b/.github/workflows/github-actions-demo.yml @@ -8,7 +8,7 @@ jobs: - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." - name: Check out repository code - uses: actions/checkout@v4 + uses: actions/checkout@v2 - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." - run: echo "🖥️ The workflow is now ready to test your code on the runner." - name: List files in the repository diff --git a/bookstore/__pycache__/settings.cpython-312.pyc b/bookstore/__pycache__/settings.cpython-312.pyc index 196472f42e80e6d130e222544f39becc3da18e50..9366d0b57cac8867059f21163423e6ee530ca620 100644 GIT binary patch delta 751 zcmZ1>yGEY(G%qg~0}%Y*>7MpxBCjNq9P>ntlAsjUD9&_-D6Vvd6t+c-QQSb99Z2(} za76K@0A*5GQ$TXuix@K*Q+VdEq%%hGrSL}ar|_jRW+{LSL?d_Ax%Cr~DetCC4mfAbEeRz}8<&9*G3m^O2;+p(B%1-m*2 zxrW4hyGGt(b#ZkHb=PDp;sa{9CF0`c=;!Vq@95*>AMWZB@8KUD68wu%K~sKmD7S-T zkqS^zkt#?fFN%`M3%NhD-(oE;$jL03Jd-Di%N?i&6hg%hC;#QK<@>MFE=~!IuRb8+nUdfz|;4s7;3K delta 495 zcmZ1@ze1MxG%qg~0}vE%cS`#*kynzbhiRfliB~#93hN@qC{7^F2Bf)C*rT{pIDkCP z6fPjiy@)ZBF@6wO8 z<_u05CMMN-ffSh(S)h|;Qsls-JeX9-WK3s?5=>Ey5=v2u5>DZa5&>dSAQnqejuKB% ziIPZBO;H1SSbY&=ipCt~D9IE}pqHhX7*eHic^EYSK)e(!sT9UF+N+r$QmYvubd*db zlcvsQFXmRp%@J;j($yme(RHrFBnTN-L=N4D6t8D8>^V%|f64}hh=f%kSk%xhkXL3Hj7<(gYkt0wZ E09(6K%m4rY diff --git a/bookstore/settings.py b/bookstore/settings.py index edf8831..859ec10 100644 --- a/bookstore/settings.py +++ b/bookstore/settings.py @@ -24,9 +24,9 @@ SECRET_KEY = "django-insecure-f*k@=53bc5!shef1-6w+m$-g)kspbaljz%8k4(j7iuc-u2_dyd" # SECURITY WARNING: don't run with debug turned on in production! -# DEBUG = True +DEBUG = True -# ALLOWED_HOSTS = [] +ALLOWED_HOSTS = [] # Application definition @@ -150,10 +150,10 @@ "127.0.0.1", ] -# SECRET_KEY = os.environ.get("SECRET_KEY") +SECRET_KEY = os.environ.get("SECRET_KEY") DEBUG = int(os.environ.get("DEBUG", default=0)) # 'DJANGO_ALLOWED_HOSTS' should be a single string of hosts with a space between each. # For example: 'DJANGO_ALLOWED_HOSTS=localhost 127.0.0.1 [::1]' -# ALLOWED_HOSTS = os.environ.get("DJANGO_ALLOWED_HOSTS").split(" ") \ No newline at end of file +ALLOWED_HOSTS = os.environ.get("DJANGO_ALLOWED_HOSTS").split(" ") \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 82b27c8..6945003 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -15,7 +15,7 @@ services: build: . command: python manage.py runserver 0.0.0.0:8000 volumes: - - .:/usr/src/app/ + - app_data:/usr/src/app/ ports: - 8000:8000 env_file: diff --git a/requirements.txt b/requirements.txt index 8f52593..dc60196 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,16 +8,22 @@ colorama==0.4.6 crashtest==0.4.1 distlib==0.3.8 Django==5.0.3 +django-debug-toolbar==4.3.0 +django-extensions==3.2.3 +django-rest-framework==0.1.0 +djangorestframework==3.15.1 dulwich==0.21.7 factory-boy==3.3.0 Faker==24.0.0 fastjsonschema==2.19.1 filelock==3.14.0 +flake8==7.0.0 idna==3.7 iniconfig==2.0.0 installer==0.7.0 jaraco.classes==3.4.0 keyring==24.3.1 +mccabe==0.7.0 more-itertools==10.2.0 msgpack==1.0.8 packaging==23.2 @@ -30,6 +36,8 @@ poetry-core==1.9.0 poetry-plugin-export==1.7.1 psycopg2==2.9.9 ptyprocess==0.7.0 +pycodestyle==2.11.1 +pyflakes==3.2.0 pyproject_hooks==1.1.0 pytest==8.0.2 python-dateutil==2.9.0.post0 From d525c71a87a5e8182aafb638ffce64449eb44222 Mon Sep 17 00:00:00 2001 From: matheus-dev-fullstack Date: Sun, 19 May 2024 20:15:03 -0300 Subject: [PATCH 06/19] Ajustando build para github actions --- .github/workflows/build.yml | 8 +++++--- .../__pycache__/settings.cpython-312.pyc | Bin 4012 -> 4012 bytes bookstore/settings.py | 2 +- docker-compose.yml | 3 ++- .../tests_viewsets/test_product_viewset.py | 9 ++++----- product/viewsets/product_viewset.py | 2 +- 6 files changed, 13 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4dfaf32..e276b29 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,13 +1,15 @@ +name: Python application + on: [push] -jobs: +jobs: build: strategy: fail-fast: false matrix: python-version: [3.8, 3.9] poetry-version: [1.1.4] - + runs-on: ubuntu-latest steps: @@ -17,7 +19,7 @@ jobs: uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} - + - name: Install poetry ${{ matrix.poetry-version }} run: | python -m ensurepip diff --git a/bookstore/__pycache__/settings.cpython-312.pyc b/bookstore/__pycache__/settings.cpython-312.pyc index 9366d0b57cac8867059f21163423e6ee530ca620..5db735e5c84c69bb61daa03fb6150d2a1276973a 100644 GIT binary patch delta 22 ccmZ1@zeb+-G%qg~0}$A@dZoSF$UC1O07X9rUjP6A delta 22 ccmZ1@zeb+-G%qg~0}%Y*>7MpxBkz2E08NqyPyhe` diff --git a/bookstore/settings.py b/bookstore/settings.py index 859ec10..c746d5e 100644 --- a/bookstore/settings.py +++ b/bookstore/settings.py @@ -156,4 +156,4 @@ # 'DJANGO_ALLOWED_HOSTS' should be a single string of hosts with a space between each. # For example: 'DJANGO_ALLOWED_HOSTS=localhost 127.0.0.1 [::1]' -ALLOWED_HOSTS = os.environ.get("DJANGO_ALLOWED_HOSTS").split(" ") \ No newline at end of file +ALLOWED_HOSTS = os.environ.get("DJANGO_ALLOWED_HOSTS").split(" ") diff --git a/docker-compose.yml b/docker-compose.yml index 6945003..b1dbbcc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -24,4 +24,5 @@ services: - db volumes: - postgres_data: \ No newline at end of file + postgres_data: + app_data: \ No newline at end of file diff --git a/product/tests/tests_viewsets/test_product_viewset.py b/product/tests/tests_viewsets/test_product_viewset.py index 3fce81e..a943941 100644 --- a/product/tests/tests_viewsets/test_product_viewset.py +++ b/product/tests/tests_viewsets/test_product_viewset.py @@ -13,7 +13,7 @@ class TestProductViewSet(APITestCase): def setUp(self): self.client = APIClient() self.user = UserFactory() - self.token = Token.objects.create(user=self.user) + self.token = Token.objects.create(user=self.user) self.product = ProductFactory( title="pro controller", @@ -21,9 +21,8 @@ def setUp(self): ) def test_get_all_product(self): - token = Token.objects.get(user__username=self.user.username) - self.client.credentials( - HTTP_AUTHORIZATION="Token " + token.key) + token = Token.objects.get(user__username=self.user.username) + self.client.credentials(HTTP_AUTHORIZATION="Token " + token.key) response = self.client.get(reverse("product-list", kwargs={"version": "v1"})) self.assertEqual(response.status_code, status.HTTP_200_OK) @@ -43,7 +42,7 @@ def test_create_product(self): ) print("Data sent1:", data) - + response = self.client.post( reverse("product-list", kwargs={"version": "v1"}), data=data, diff --git a/product/viewsets/product_viewset.py b/product/viewsets/product_viewset.py index 3da4e56..7d62539 100644 --- a/product/viewsets/product_viewset.py +++ b/product/viewsets/product_viewset.py @@ -11,4 +11,4 @@ class ProductViewSet(ModelViewSet): serializer_class = ProductSerializer def get_queryset(self): - return Product.objects.all().order_by('id') + return Product.objects.all().order_by("id") From a3ec9827ad317cf4c7c1e0cf7784fd89e460c1ea Mon Sep 17 00:00:00 2001 From: matheus-dev-fullstack Date: Sun, 19 May 2024 20:18:25 -0300 Subject: [PATCH 07/19] =?UTF-8?q?=20Github=20Actions=20-=20Atualizando=20p?= =?UTF-8?q?oetry=20para=20corrigir=20importa=C3=A7=C3=A3o\?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- poetry.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/poetry.lock b/poetry.lock index df0ccec..512fcff 100644 --- a/poetry.lock +++ b/poetry.lock @@ -121,13 +121,13 @@ doc = ["Sphinx", "sphinx-rtd-theme", "sphinxcontrib-spelling"] [[package]] name = "faker" -version = "25.1.0" +version = "25.2.0" description = "Faker is a Python package that generates fake data for you." optional = false python-versions = ">=3.8" files = [ - {file = "Faker-25.1.0-py3-none-any.whl", hash = "sha256:24e28dce0b89683bb9e017e042b971c8c4909cff551b6d46f1e207674c7c2526"}, - {file = "Faker-25.1.0.tar.gz", hash = "sha256:2107618cf306bb188dcfea3e5cfd94aa92d65c7293a2437c1e96a99c83274755"}, + {file = "Faker-25.2.0-py3-none-any.whl", hash = "sha256:cfe97c4857c4c36ee32ea4aaabef884895992e209bae4cbd26807cf3e05c6918"}, + {file = "Faker-25.2.0.tar.gz", hash = "sha256:45b84f47ff1ef86e3d1a8d11583ca871ecf6730fad0660edadc02576583a2423"}, ] [package.dependencies] @@ -302,13 +302,13 @@ files = [ [[package]] name = "pytest" -version = "8.2.0" +version = "8.2.1" description = "pytest: simple powerful testing with Python" optional = false python-versions = ">=3.8" files = [ - {file = "pytest-8.2.0-py3-none-any.whl", hash = "sha256:1733f0620f6cda4095bbf0d9ff8022486e91892245bb9e7d5542c018f612f233"}, - {file = "pytest-8.2.0.tar.gz", hash = "sha256:d507d4482197eac0ba2bae2e9babf0672eb333017bcedaa5fb1a3d42c1174b3f"}, + {file = "pytest-8.2.1-py3-none-any.whl", hash = "sha256:faccc5d332b8c3719f40283d0d44aa5cf101cec36f88cde9ed8f2bc0538612b1"}, + {file = "pytest-8.2.1.tar.gz", hash = "sha256:5046e5b46d8e4cac199c373041f26be56fdb81eb4e67dc11d4e10811fc3408fd"}, ] [package.dependencies] From 1a4c9f4d113d187e1ea3aa71089d841171082e89 Mon Sep 17 00:00:00 2001 From: matheus-dev-fullstack Date: Sun, 19 May 2024 20:21:39 -0300 Subject: [PATCH 08/19] =?UTF-8?q?Github=20Actions=20-=20Teste=20de=20alter?= =?UTF-8?q?a=C3=A7=C3=A3o=20de=20vers=C3=A3o=20do=20poetry?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e276b29..cd272c5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,6 +22,7 @@ jobs: - name: Install poetry ${{ matrix.poetry-version }} run: | + curl -sSL https://install.python-poetry.org | python3 - python -m ensurepip python -m pip install --upgrade pip python -m pip install poetry==${{ matrix.poetry-version }} From 9266ee0a261aab29d3b9200b23579168fdc6a980 Mon Sep 17 00:00:00 2001 From: matheus-dev-fullstack Date: Sun, 19 May 2024 20:24:11 -0300 Subject: [PATCH 09/19] =?UTF-8?q?Github=20Actions=20-=20Teste=20de=20alter?= =?UTF-8?q?a=C3=A7=C3=A3o=20de=20vers=C3=A3o=20do=20poetry?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cd272c5..3adad89 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,12 +23,15 @@ jobs: - name: Install poetry ${{ matrix.poetry-version }} run: | curl -sSL https://install.python-poetry.org | python3 - - python -m ensurepip - python -m pip install --upgrade pip - python -m pip install poetry==${{ matrix.poetry-version }} + echo "$HOME/.local/bin" >> $GITHUB_PATH + + - name: View poetry --help run: poetry --help + - name: Clear Poetry Cache + run: poetry cache clear --all pypi + - name: Install dependencies shell: bash run: python -m poetry install From b0827da65303c9942db0ea832896d926bf69d516 Mon Sep 17 00:00:00 2001 From: matheus-dev-fullstack Date: Sun, 19 May 2024 20:25:32 -0300 Subject: [PATCH 10/19] =?UTF-8?q?Github=20Actions=20-=20Teste=20de=20alter?= =?UTF-8?q?a=C3=A7=C3=A3o=20de=20vers=C3=A3o=20do=20poetry?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3adad89..0cfe571 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,9 +29,6 @@ jobs: - name: View poetry --help run: poetry --help - - name: Clear Poetry Cache - run: poetry cache clear --all pypi - - name: Install dependencies shell: bash run: python -m poetry install From 809702236a897f434e99c5bb98b03a7f2f425235 Mon Sep 17 00:00:00 2001 From: matheus-dev-fullstack Date: Sun, 19 May 2024 20:28:04 -0300 Subject: [PATCH 11/19] =?UTF-8?q?Github=20Actions=20-=20Teste=20de=20alter?= =?UTF-8?q?a=C3=A7=C3=A3o=20de=20vers=C3=A3o=20do=20poetry?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0cfe571..5ef76aa 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,8 +30,7 @@ jobs: run: poetry --help - name: Install dependencies - shell: bash - run: python -m poetry install + run: poetry install - name: Test run: | From 2606d6dff2e16fc9fddf5c9e87223fb14deed201 Mon Sep 17 00:00:00 2001 From: matheus-dev-fullstack Date: Sun, 19 May 2024 20:30:01 -0300 Subject: [PATCH 12/19] =?UTF-8?q?Github=20Actions=20-=20Teste=20de=20alter?= =?UTF-8?q?a=C3=A7=C3=A3o=20de=20vers=C3=A3o=20do=20poetry?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index c2207b9..dfecbb6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ authors = ["matheus-dev-fullstack "] readme = "README.md" [tool.poetry.dependencies] -python = "^3.12" +python = "^3.8" pytest = "^8.0.2" psycopg2-binary = "*" factory-boy = "^3.3.0" From e6858b8ea24bef1f48423f4c0ee24743ba742aac Mon Sep 17 00:00:00 2001 From: matheus-dev-fullstack Date: Sun, 19 May 2024 20:36:00 -0300 Subject: [PATCH 13/19] =?UTF-8?q?Github=20Actions=20-=20Alterando=20vers?= =?UTF-8?q?=C3=A3o=20das=20dependencias=20no=20pyproject.toml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- poetry.lock | 327 ++++++++++++++++++++++++++++++++++++++----------- pyproject.toml | 27 ++-- 2 files changed, 272 insertions(+), 82 deletions(-) diff --git a/poetry.lock b/poetry.lock index 512fcff..9a59f72 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2,18 +2,96 @@ [[package]] name = "asgiref" -version = "3.8.1" +version = "3.7.2" description = "ASGI specs, helper code, and adapters" optional = false -python-versions = ">=3.8" +python-versions = ">=3.7" files = [ - {file = "asgiref-3.8.1-py3-none-any.whl", hash = "sha256:3e1e3ecc849832fe52ccf2cb6686b7a55f82bb1d6aee72a58826471390335e47"}, - {file = "asgiref-3.8.1.tar.gz", hash = "sha256:c343bd80a0bec947a9860adb4c432ffa7db769836c64238fc34bdc3fec84d590"}, + {file = "asgiref-3.7.2-py3-none-any.whl", hash = "sha256:89b2ef2247e3b562a16eef663bc0e2e703ec6468e2fa8a5cd61cd449786d4f6e"}, + {file = "asgiref-3.7.2.tar.gz", hash = "sha256:9e0ce3aa93a819ba5b45120216b23878cf6e8525eb3848653452b4192b92afed"}, ] +[package.dependencies] +typing-extensions = {version = ">=4", markers = "python_version < \"3.11\""} + [package.extras] tests = ["mypy (>=0.800)", "pytest", "pytest-asyncio"] +[[package]] +name = "atomicwrites" +version = "1.4.1" +description = "Atomic file writes." +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +files = [ + {file = "atomicwrites-1.4.1.tar.gz", hash = "sha256:81b2c9071a49367a7f770170e5eec8cb66567cfbbc8c73d20ce5ca4a8d71cf11"}, +] + +[[package]] +name = "attrs" +version = "23.2.0" +description = "Classes Without Boilerplate" +optional = false +python-versions = ">=3.7" +files = [ + {file = "attrs-23.2.0-py3-none-any.whl", hash = "sha256:99b87a485a5820b23b879f04c2305b44b951b502fd64be915879d77a7e8fc6f1"}, + {file = "attrs-23.2.0.tar.gz", hash = "sha256:935dc3b529c262f6cf76e50877d35a4bd3c1de194fd41f47a2b7ae8f19971f30"}, +] + +[package.dependencies] +importlib-metadata = {version = "*", markers = "python_version < \"3.8\""} + +[package.extras] +cov = ["attrs[tests]", "coverage[toml] (>=5.3)"] +dev = ["attrs[tests]", "pre-commit"] +docs = ["furo", "myst-parser", "sphinx", "sphinx-notfound-page", "sphinxcontrib-towncrier", "towncrier", "zope-interface"] +tests = ["attrs[tests-no-zope]", "zope-interface"] +tests-mypy = ["mypy (>=1.6)", "pytest-mypy-plugins"] +tests-no-zope = ["attrs[tests-mypy]", "cloudpickle", "hypothesis", "pympler", "pytest (>=4.3.0)", "pytest-xdist[psutil]"] + +[[package]] +name = "autopep8" +version = "1.7.0" +description = "A tool that automatically formats Python code to conform to the PEP 8 style guide" +optional = false +python-versions = "*" +files = [ + {file = "autopep8-1.7.0-py2.py3-none-any.whl", hash = "sha256:6f09e90a2be784317e84dc1add17ebfc7abe3924239957a37e5040e27d812087"}, + {file = "autopep8-1.7.0.tar.gz", hash = "sha256:ca9b1a83e53a7fad65d731dc7a2a2d50aa48f43850407c59f6a1a306c4201142"}, +] + +[package.dependencies] +pycodestyle = ">=2.9.1" +toml = "*" + +[[package]] +name = "backports-zoneinfo" +version = "0.2.1" +description = "Backport of the standard library zoneinfo module" +optional = false +python-versions = ">=3.6" +files = [ + {file = "backports.zoneinfo-0.2.1-cp36-cp36m-macosx_10_14_x86_64.whl", hash = "sha256:da6013fd84a690242c310d77ddb8441a559e9cb3d3d59ebac9aca1a57b2e18bc"}, + {file = "backports.zoneinfo-0.2.1-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:89a48c0d158a3cc3f654da4c2de1ceba85263fafb861b98b59040a5086259722"}, + {file = "backports.zoneinfo-0.2.1-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:1c5742112073a563c81f786e77514969acb58649bcdf6cdf0b4ed31a348d4546"}, + {file = "backports.zoneinfo-0.2.1-cp36-cp36m-win32.whl", hash = "sha256:e8236383a20872c0cdf5a62b554b27538db7fa1bbec52429d8d106effbaeca08"}, + {file = "backports.zoneinfo-0.2.1-cp36-cp36m-win_amd64.whl", hash = "sha256:8439c030a11780786a2002261569bdf362264f605dfa4d65090b64b05c9f79a7"}, + {file = "backports.zoneinfo-0.2.1-cp37-cp37m-macosx_10_14_x86_64.whl", hash = "sha256:f04e857b59d9d1ccc39ce2da1021d196e47234873820cbeaad210724b1ee28ac"}, + {file = "backports.zoneinfo-0.2.1-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:17746bd546106fa389c51dbea67c8b7c8f0d14b5526a579ca6ccf5ed72c526cf"}, + {file = "backports.zoneinfo-0.2.1-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:5c144945a7752ca544b4b78c8c41544cdfaf9786f25fe5ffb10e838e19a27570"}, + {file = "backports.zoneinfo-0.2.1-cp37-cp37m-win32.whl", hash = "sha256:e55b384612d93be96506932a786bbcde5a2db7a9e6a4bb4bffe8b733f5b9036b"}, + {file = "backports.zoneinfo-0.2.1-cp37-cp37m-win_amd64.whl", hash = "sha256:a76b38c52400b762e48131494ba26be363491ac4f9a04c1b7e92483d169f6582"}, + {file = "backports.zoneinfo-0.2.1-cp38-cp38-macosx_10_14_x86_64.whl", hash = "sha256:8961c0f32cd0336fb8e8ead11a1f8cd99ec07145ec2931122faaac1c8f7fd987"}, + {file = "backports.zoneinfo-0.2.1-cp38-cp38-manylinux1_i686.whl", hash = "sha256:e81b76cace8eda1fca50e345242ba977f9be6ae3945af8d46326d776b4cf78d1"}, + {file = "backports.zoneinfo-0.2.1-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:7b0a64cda4145548fed9efc10322770f929b944ce5cee6c0dfe0c87bf4c0c8c9"}, + {file = "backports.zoneinfo-0.2.1-cp38-cp38-win32.whl", hash = "sha256:1b13e654a55cd45672cb54ed12148cd33628f672548f373963b0bff67b217328"}, + {file = "backports.zoneinfo-0.2.1-cp38-cp38-win_amd64.whl", hash = "sha256:4a0f800587060bf8880f954dbef70de6c11bbe59c673c3d818921f042f9954a6"}, + {file = "backports.zoneinfo-0.2.1.tar.gz", hash = "sha256:fadbfe37f74051d024037f223b8e001611eac868b5c5b06144ef4d8b799862f2"}, +] + +[package.extras] +tzdata = ["tzdata"] + [[package]] name = "colorama" version = "0.4.6" @@ -27,19 +105,19 @@ files = [ [[package]] name = "django" -version = "5.0.6" -description = "A high-level Python web framework that encourages rapid development and clean, pragmatic design." +version = "3.2.25" +description = "A high-level Python Web framework that encourages rapid development and clean, pragmatic design." optional = false -python-versions = ">=3.10" +python-versions = ">=3.6" files = [ - {file = "Django-5.0.6-py3-none-any.whl", hash = "sha256:8363ac062bb4ef7c3f12d078f6fa5d154031d129a15170a1066412af49d30905"}, - {file = "Django-5.0.6.tar.gz", hash = "sha256:ff1b61005004e476e0aeea47c7f79b85864c70124030e95146315396f1e7951f"}, + {file = "Django-3.2.25-py3-none-any.whl", hash = "sha256:a52ea7fcf280b16f7b739cec38fa6d3f8953a5456986944c3ca97e79882b4e38"}, + {file = "Django-3.2.25.tar.gz", hash = "sha256:7ca38a78654aee72378594d63e51636c04b8e28574f5505dff630895b5472777"}, ] [package.dependencies] -asgiref = ">=3.7.0,<4" -sqlparse = ">=0.3.1" -tzdata = {version = "*", markers = "sys_platform == \"win32\""} +asgiref = ">=3.3.2,<4" +pytz = "*" +sqlparse = ">=0.2.2" [package.extras] argon2 = ["argon2-cffi (>=19.1.0)"] @@ -47,13 +125,13 @@ bcrypt = ["bcrypt"] [[package]] name = "django-debug-toolbar" -version = "4.3.0" +version = "3.8.1" description = "A configurable set of panels that display various debug information about the current request/response." optional = false -python-versions = ">=3.8" +python-versions = ">=3.7" files = [ - {file = "django_debug_toolbar-4.3.0-py3-none-any.whl", hash = "sha256:e09b7dcb8417b743234dfc57c95a7c1d1d87a88844abd13b4c5387f807b31bf6"}, - {file = "django_debug_toolbar-4.3.0.tar.gz", hash = "sha256:0b0dddee5ea29b9cb678593bc0d7a6d76b21d7799cb68e091a2148341a80f3c4"}, + {file = "django_debug_toolbar-3.8.1-py3-none-any.whl", hash = "sha256:879f8a4672d41621c06a4d322dcffa630fc4df056cada6e417ed01db0e5e0478"}, + {file = "django_debug_toolbar-3.8.1.tar.gz", hash = "sha256:24ef1a7d44d25e60d7951e378454c6509bf536dce7e7d9d36e7c387db499bc27"}, ] [package.dependencies] @@ -99,6 +177,7 @@ files = [ ] [package.dependencies] +"backports.zoneinfo" = {version = "*", markers = "python_version < \"3.9\""} django = ">=3.0" [[package]] @@ -114,6 +193,7 @@ files = [ [package.dependencies] Faker = ">=0.7.0" +importlib-metadata = {version = "*", markers = "python_version < \"3.8\""} [package.extras] dev = ["Django", "Pillow", "SQLAlchemy", "coverage", "flake8", "isort", "mongoengine", "sqlalchemy-utils", "tox", "wheel (>=0.32.0)", "zest.releaser[recommended]"] @@ -121,33 +201,58 @@ doc = ["Sphinx", "sphinx-rtd-theme", "sphinxcontrib-spelling"] [[package]] name = "faker" -version = "25.2.0" +version = "18.13.0" description = "Faker is a Python package that generates fake data for you." optional = false -python-versions = ">=3.8" +python-versions = ">=3.7" files = [ - {file = "Faker-25.2.0-py3-none-any.whl", hash = "sha256:cfe97c4857c4c36ee32ea4aaabef884895992e209bae4cbd26807cf3e05c6918"}, - {file = "Faker-25.2.0.tar.gz", hash = "sha256:45b84f47ff1ef86e3d1a8d11583ca871ecf6730fad0660edadc02576583a2423"}, + {file = "Faker-18.13.0-py3-none-any.whl", hash = "sha256:801d1a2d71f1fc54d332de2ab19de7452454309937233ea2f7485402882d67b3"}, + {file = "Faker-18.13.0.tar.gz", hash = "sha256:84bcf92bb725dd7341336eea4685df9a364f16f2470c4d29c1d7e6c5fd5a457d"}, ] [package.dependencies] python-dateutil = ">=2.4" +typing-extensions = {version = ">=3.10.0.1", markers = "python_version < \"3.8\""} + +[[package]] +name = "gunicorn" +version = "20.1.0" +description = "WSGI HTTP Server for UNIX" +optional = false +python-versions = ">=3.5" +files = [ + {file = "gunicorn-20.1.0-py3-none-any.whl", hash = "sha256:9dcc4547dbb1cb284accfb15ab5667a0e5d1881cc443e0677b4882a4067a807e"}, + {file = "gunicorn-20.1.0.tar.gz", hash = "sha256:e0a968b5ba15f8a328fdfd7ab1fcb5af4470c28aaf7e55df02a99bc13138e6e8"}, +] + +[package.dependencies] +setuptools = ">=3.0" + +[package.extras] +eventlet = ["eventlet (>=0.24.1)"] +gevent = ["gevent (>=1.4.0)"] +setproctitle = ["setproctitle"] +tornado = ["tornado (>=0.2)"] [[package]] -name = "flake8" -version = "7.0.0" -description = "the modular source code checker: pep8 pyflakes and co" +name = "importlib-metadata" +version = "6.7.0" +description = "Read metadata from Python packages" optional = false -python-versions = ">=3.8.1" +python-versions = ">=3.7" files = [ - {file = "flake8-7.0.0-py2.py3-none-any.whl", hash = "sha256:a6dfbb75e03252917f2473ea9653f7cd799c3064e54d4c8140044c5c065f53c3"}, - {file = "flake8-7.0.0.tar.gz", hash = "sha256:33f96621059e65eec474169085dc92bf26e7b2d47366b70be2f67ab80dc25132"}, + {file = "importlib_metadata-6.7.0-py3-none-any.whl", hash = "sha256:cb52082e659e97afc5dac71e79de97d8681de3aa07ff18578330904a9d18e5b5"}, + {file = "importlib_metadata-6.7.0.tar.gz", hash = "sha256:1aaf550d4f73e5d6783e7acb77aec43d49da8017410afae93822cc9cca98c4d4"}, ] [package.dependencies] -mccabe = ">=0.7.0,<0.8.0" -pycodestyle = ">=2.11.0,<2.12.0" -pyflakes = ">=3.2.0,<3.3.0" +typing-extensions = {version = ">=3.6.4", markers = "python_version < \"3.8\""} +zipp = ">=0.5" + +[package.extras] +docs = ["furo", "jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"] +perf = ["ipython"] +testing = ["flufl.flake8", "importlib-resources (>=1.3)", "packaging", "pyfakefs", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-mypy (>=0.9.1)", "pytest-perf (>=0.9.2)", "pytest-ruff"] [[package]] name = "iniconfig" @@ -161,16 +266,22 @@ files = [ ] [[package]] -name = "mccabe" -version = "0.7.0" -description = "McCabe checker, plugin for flake8" +name = "isort" +version = "5.11.5" +description = "A Python utility / library to sort Python imports." optional = false -python-versions = ">=3.6" +python-versions = ">=3.7.0" files = [ - {file = "mccabe-0.7.0-py2.py3-none-any.whl", hash = "sha256:6c2d30ab6be0e4a46919781807b4f0d834ebdd6c6e3dca0bda5a15f863427b6e"}, - {file = "mccabe-0.7.0.tar.gz", hash = "sha256:348e0240c33b60bbdf4e523192ef919f28cb2c3d7d5c7794f74009290f236325"}, + {file = "isort-5.11.5-py3-none-any.whl", hash = "sha256:ba1d72fb2595a01c7895a5128f9585a5cc4b6d395f1c8d514989b9a7eb2a8746"}, + {file = "isort-5.11.5.tar.gz", hash = "sha256:6be1f76a507cb2ecf16c7cf14a37e41609ca082330be4e3436a18ef74add55db"}, ] +[package.extras] +colors = ["colorama (>=0.4.3,<0.5.0)"] +pipfile-deprecated-finder = ["pip-shims (>=0.5.2)", "pipreqs", "requirementslib"] +plugins = ["setuptools"] +requirements-deprecated-finder = ["pip-api", "pipreqs"] + [[package]] name = "packaging" version = "24.0" @@ -184,15 +295,18 @@ files = [ [[package]] name = "pluggy" -version = "1.5.0" +version = "1.2.0" description = "plugin and hook calling mechanisms for python" optional = false -python-versions = ">=3.8" +python-versions = ">=3.7" files = [ - {file = "pluggy-1.5.0-py3-none-any.whl", hash = "sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669"}, - {file = "pluggy-1.5.0.tar.gz", hash = "sha256:2cffa88e94fdc978c4c574f15f9e59b7f4201d439195c3715ca9e2486f1d0cf1"}, + {file = "pluggy-1.2.0-py3-none-any.whl", hash = "sha256:c2fd55a7d7a3863cba1a013e4e2414658b1d07b6bc57b3919e0c63c9abb99849"}, + {file = "pluggy-1.2.0.tar.gz", hash = "sha256:d12f0c4b579b15f5e054301bb226ee85eeeba08ffec228092f8defbaa3a4c4b3"}, ] +[package.dependencies] +importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} + [package.extras] dev = ["pre-commit", "tox"] testing = ["pytest", "pytest-benchmark"] @@ -279,46 +393,51 @@ files = [ ] [[package]] -name = "pycodestyle" -version = "2.11.1" -description = "Python style guide checker" +name = "py" +version = "1.11.0" +description = "library with cross-python path, ini-parsing, io, code, log facilities" optional = false -python-versions = ">=3.8" +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" files = [ - {file = "pycodestyle-2.11.1-py2.py3-none-any.whl", hash = "sha256:44fe31000b2d866f2e41841b18528a505fbd7fef9017b04eff4e2648a0fadc67"}, - {file = "pycodestyle-2.11.1.tar.gz", hash = "sha256:41ba0e7afc9752dfb53ced5489e89f8186be00e599e712660695b7a75ff2663f"}, + {file = "py-1.11.0-py2.py3-none-any.whl", hash = "sha256:607c53218732647dff4acdfcd50cb62615cedf612e72d1724fb1a0cc6405b378"}, + {file = "py-1.11.0.tar.gz", hash = "sha256:51c75c4126074b472f746a24399ad32f6053d1b34b68d2fa41e558e6f4a98719"}, ] [[package]] -name = "pyflakes" -version = "3.2.0" -description = "passive checker of Python programs" +name = "pycodestyle" +version = "2.10.0" +description = "Python style guide checker" optional = false -python-versions = ">=3.8" +python-versions = ">=3.6" files = [ - {file = "pyflakes-3.2.0-py2.py3-none-any.whl", hash = "sha256:84b5be138a2dfbb40689ca07e2152deb896a65c3a3e24c251c5c62489568074a"}, - {file = "pyflakes-3.2.0.tar.gz", hash = "sha256:1c61603ff154621fb2a9172037d84dca3500def8c8b630657d1701f026f8af3f"}, + {file = "pycodestyle-2.10.0-py2.py3-none-any.whl", hash = "sha256:8a4eaf0d0495c7395bdab3589ac2db602797d76207242c17d470186815706610"}, + {file = "pycodestyle-2.10.0.tar.gz", hash = "sha256:347187bdb476329d98f695c213d7295a846d1152ff4fe9bacb8a9590b8ee7053"}, ] [[package]] name = "pytest" -version = "8.2.1" +version = "6.2.5" description = "pytest: simple powerful testing with Python" optional = false -python-versions = ">=3.8" +python-versions = ">=3.6" files = [ - {file = "pytest-8.2.1-py3-none-any.whl", hash = "sha256:faccc5d332b8c3719f40283d0d44aa5cf101cec36f88cde9ed8f2bc0538612b1"}, - {file = "pytest-8.2.1.tar.gz", hash = "sha256:5046e5b46d8e4cac199c373041f26be56fdb81eb4e67dc11d4e10811fc3408fd"}, + {file = "pytest-6.2.5-py3-none-any.whl", hash = "sha256:7310f8d27bc79ced999e760ca304d69f6ba6c6649c0b60fb0e04a4a77cacc134"}, + {file = "pytest-6.2.5.tar.gz", hash = "sha256:131b36680866a76e6781d13f101efb86cf674ebb9762eb70d3082b6f29889e89"}, ] [package.dependencies] +atomicwrites = {version = ">=1.0", markers = "sys_platform == \"win32\""} +attrs = ">=19.2.0" colorama = {version = "*", markers = "sys_platform == \"win32\""} +importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} iniconfig = "*" packaging = "*" -pluggy = ">=1.5,<2.0" +pluggy = ">=0.12,<2.0" +py = ">=1.8.2" +toml = "*" [package.extras] -dev = ["argcomplete", "attrs (>=19.2)", "hypothesis (>=3.56)", "mock", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] +testing = ["argcomplete", "hypothesis (>=3.56)", "mock", "nose", "requests", "xmlschema"] [[package]] name = "python-dateutil" @@ -334,6 +453,33 @@ files = [ [package.dependencies] six = ">=1.5" +[[package]] +name = "pytz" +version = "2024.1" +description = "World timezone definitions, modern and historical" +optional = false +python-versions = "*" +files = [ + {file = "pytz-2024.1-py2.py3-none-any.whl", hash = "sha256:328171f4e3623139da4983451950b28e95ac706e13f3f2630a879749e7a8b319"}, + {file = "pytz-2024.1.tar.gz", hash = "sha256:2a29735ea9c18baf14b448846bde5a48030ed267578472d8955cd0e7443a9812"}, +] + +[[package]] +name = "setuptools" +version = "68.0.0" +description = "Easily download, build, install, upgrade, and uninstall Python packages" +optional = false +python-versions = ">=3.7" +files = [ + {file = "setuptools-68.0.0-py3-none-any.whl", hash = "sha256:11e52c67415a381d10d6b462ced9cfb97066179f0e871399e006c4ab101fc85f"}, + {file = "setuptools-68.0.0.tar.gz", hash = "sha256:baf1fdb41c6da4cd2eae722e135500da913332ab3f2f5c7d33af9b492acb5235"}, +] + +[package.extras] +docs = ["furo", "jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "pygments-github-lexers (==0.0.5)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-favicon", "sphinx-hoverxref (<2)", "sphinx-inline-tabs", "sphinx-lint", "sphinx-notfound-page (==0.8.3)", "sphinx-reredirects", "sphinxcontrib-towncrier"] +testing = ["build[virtualenv]", "filelock (>=3.4.0)", "flake8-2020", "ini2toml[lite] (>=0.9)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "pip (>=19.1)", "pip-run (>=8.8)", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-mypy (>=0.9.1)", "pytest-perf", "pytest-ruff", "pytest-timeout", "pytest-xdist", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel"] +testing-integration = ["build[virtualenv]", "filelock (>=3.4.0)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "pytest", "pytest-enabler", "pytest-xdist", "tomli", "virtualenv (>=13.0.0)", "wheel"] + [[package]] name = "six" version = "1.16.0" @@ -347,31 +493,72 @@ files = [ [[package]] name = "sqlparse" -version = "0.5.0" +version = "0.4.4" description = "A non-validating SQL parser." optional = false -python-versions = ">=3.8" +python-versions = ">=3.5" files = [ - {file = "sqlparse-0.5.0-py3-none-any.whl", hash = "sha256:c204494cd97479d0e39f28c93d46c0b2d5959c7b9ab904762ea6c7af211c8663"}, - {file = "sqlparse-0.5.0.tar.gz", hash = "sha256:714d0a4932c059d16189f58ef5411ec2287a4360f17cdd0edd2d09d4c5087c93"}, + {file = "sqlparse-0.4.4-py3-none-any.whl", hash = "sha256:5430a4fe2ac7d0f93e66f1efc6e1338a41884b7ddf2a350cedd20ccc4d9d28f3"}, + {file = "sqlparse-0.4.4.tar.gz", hash = "sha256:d446183e84b8349fa3061f0fe7f06ca94ba65b426946ffebe6e3e8295332420c"}, ] [package.extras] -dev = ["build", "hatch"] +dev = ["build", "flake8"] doc = ["sphinx"] +test = ["pytest", "pytest-cov"] [[package]] -name = "tzdata" -version = "2024.1" -description = "Provider of IANA time zone data" +name = "toml" +version = "0.10.2" +description = "Python Library for Tom's Obvious, Minimal Language" optional = false -python-versions = ">=2" +python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" files = [ - {file = "tzdata-2024.1-py2.py3-none-any.whl", hash = "sha256:9068bc196136463f5245e51efda838afa15aaeca9903f49050dfa2679db4d252"}, - {file = "tzdata-2024.1.tar.gz", hash = "sha256:2674120f8d891909751c38abcdfd386ac0a5a1127954fbc332af6b5ceae07efd"}, + {file = "toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"}, + {file = "toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"}, ] +[[package]] +name = "typing-extensions" +version = "4.7.1" +description = "Backported and Experimental Type Hints for Python 3.7+" +optional = false +python-versions = ">=3.7" +files = [ + {file = "typing_extensions-4.7.1-py3-none-any.whl", hash = "sha256:440d5dd3af93b060174bf433bccd69b0babc3b15b1a8dca43789fd7f61514b36"}, + {file = "typing_extensions-4.7.1.tar.gz", hash = "sha256:b75ddc264f0ba5615db7ba217daeb99701ad295353c45f9e95963337ceeeffb2"}, +] + +[[package]] +name = "whitenoise" +version = "5.3.0" +description = "Radically simplified static file serving for WSGI applications" +optional = false +python-versions = ">=3.5, <4" +files = [ + {file = "whitenoise-5.3.0-py2.py3-none-any.whl", hash = "sha256:d963ef25639d1417e8a247be36e6aedd8c7c6f0a08adcb5a89146980a96b577c"}, + {file = "whitenoise-5.3.0.tar.gz", hash = "sha256:d234b871b52271ae7ed6d9da47ffe857c76568f11dd30e28e18c5869dbd11e12"}, +] + +[package.extras] +brotli = ["Brotli"] + +[[package]] +name = "zipp" +version = "3.15.0" +description = "Backport of pathlib-compatible object wrapper for zip files" +optional = false +python-versions = ">=3.7" +files = [ + {file = "zipp-3.15.0-py3-none-any.whl", hash = "sha256:48904fc76a60e542af151aded95726c1a5c34ed43ab4134b597665c86d7ad556"}, + {file = "zipp-3.15.0.tar.gz", hash = "sha256:112929ad649da941c23de50f356a2b5570c954b65150642bccdd66bf194d224b"}, +] + +[package.extras] +docs = ["furo", "jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"] +testing = ["big-O", "flake8 (<5)", "jaraco.functools", "jaraco.itertools", "more-itertools", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-flake8", "pytest-mypy (>=0.9.1)"] + [metadata] lock-version = "2.0" -python-versions = "^3.12" -content-hash = "4e6e0fdefbb923f51712ef536efdc91fb2d5aa948e2d3aa4f41d79bdb27a4104" +python-versions = "^3.7" +content-hash = "3d24a74ddb066994975c85b456e5889359e72bfa95d271ccd733f12dee92b275" diff --git a/pyproject.toml b/pyproject.toml index dfecbb6..a0486e1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,21 +2,24 @@ name = "bookstore" version = "0.1.0" description = "Bookstore API" -authors = ["matheus-dev-fullstack "] -readme = "README.md" +authors = ["Daniel Santos "] [tool.poetry.dependencies] -python = "^3.8" -pytest = "^8.0.2" -psycopg2-binary = "*" -factory-boy = "^3.3.0" -django = "^5.0.3" +python = "^3.7" +Django = "^3.2.8" django-rest-framework = "^0.1.0" -django-extensions = "^3.2.3" -django-debug-toolbar = "^4.3.0" -flake8 = "^7.0.0" +django-extensions = "^3.1.3" +django-debug-toolbar = "^3.2.2" +psycopg2-binary = "^2.9.2" +autopep8 = "^1.6.0" +isort = "^5.10.1" +whitenoise = "^5.3.0" +gunicorn = "^20.1.0" +[tool.poetry.dev-dependencies] +pytest = "^6.2.5" +factory-boy = "^3.2.0" [build-system] -requires = ["poetry-core"] -build-backend = "poetry.core.masonry.api" +requires = ["poetry-core>=1.0.0"] +build-backend = "poetry.core.masonry.api" \ No newline at end of file From 2e57690b2a5b93f612dcbca7c19fd75c2a2f0975 Mon Sep 17 00:00:00 2001 From: matheus-dev-fullstack Date: Sun, 19 May 2024 20:41:17 -0300 Subject: [PATCH 14/19] Congiurando ALLOWED_HOSTS em settings.py --- bookstore/settings.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bookstore/settings.py b/bookstore/settings.py index c746d5e..eb446c5 100644 --- a/bookstore/settings.py +++ b/bookstore/settings.py @@ -150,10 +150,12 @@ "127.0.0.1", ] -SECRET_KEY = os.environ.get("SECRET_KEY") +# SECRET_KEY = os.environ.get("SECRET_KEY") -DEBUG = int(os.environ.get("DEBUG", default=0)) +# DEBUG = int(os.environ.get("DEBUG", default=0)) # 'DJANGO_ALLOWED_HOSTS' should be a single string of hosts with a space between each. # For example: 'DJANGO_ALLOWED_HOSTS=localhost 127.0.0.1 [::1]' -ALLOWED_HOSTS = os.environ.get("DJANGO_ALLOWED_HOSTS").split(" ") +# ALLOWED_HOSTS = os.environ.get("DJANGO_ALLOWED_HOSTS").split(" ") + +ALLOWED_HOSTS = ['localhost', '127.0.0.1', 'ebac-bookstore-api.herokuapp.com'] \ No newline at end of file From 976aed25a1f03cd1cc611963bd7c8fe252950e4e Mon Sep 17 00:00:00 2001 From: matheus-dev-fullstack Date: Sun, 19 May 2024 21:56:56 -0300 Subject: [PATCH 15/19] Corrigindo Viewsets, e testes --- .../__pycache__/settings.cpython-312.pyc | Bin 4012 -> 3733 bytes bookstore/__pycache__/urls.cpython-312.pyc | Bin 1477 -> 1477 bytes order/__pycache__/admin.cpython-312.pyc | Bin 251 -> 251 bytes order/__pycache__/factories.cpython-312.pyc | Bin 1747 -> 1738 bytes order/__pycache__/urls.cpython-312.pyc | Bin 604 -> 604 bytes order/factories.py | 9 ++-- .../__pycache__/0001_initial.cpython-312.pyc | Bin 1400 -> 1400 bytes .../0002_alter_order_user.cpython-312.pyc | Bin 1134 -> 1134 bytes .../0003_alter_order_user.cpython-312.pyc | Bin 1118 -> 1118 bytes .../__pycache__/__init__.cpython-312.pyc | Bin 208 -> 208 bytes .../models/__pycache__/order.cpython-312.pyc | Bin 758 -> 758 bytes .../__pycache__/__init__.cpython-312.pyc | Bin 234 -> 234 bytes .../order_serializer.cpython-312.pyc | Bin 2150 -> 2154 bytes order/serializers/order_serializer.py | 2 +- .../__pycache__/__init__.cpython-312.pyc | Bin 169 -> 169 bytes order/tests/test_serializers/__init__.py | 0 .../__pycache__/__init__.cpython-312.pyc | Bin 0 -> 206 bytes .../test_order_serializer.cpython-312.pyc | Bin 0 -> 1617 bytes .../test_serializers/test_order_serializer.py | 20 +++++++++ .../__pycache__/__init__.cpython-312.pyc | Bin 183 -> 183 bytes .../test_order_viewset.cpython-312.pyc | Bin 3452 -> 3491 bytes .../tests/test_viewsets/test_order_viewset.py | 14 +++--- .../__pycache__/__init__.cpython-312.pyc | Bin 225 -> 225 bytes .../__pycache__/order_viewset.cpython-312.pyc | Bin 651 -> 706 bytes order/viewsets/order_viewset.py | 2 +- product/__pycache__/admin.cpython-312.pyc | Bin 277 -> 277 bytes product/__pycache__/factories.cpython-312.pyc | Bin 1939 -> 1939 bytes product/__pycache__/urls.cpython-312.pyc | Bin 610 -> 721 bytes .../__pycache__/0001_initial.cpython-312.pyc | Bin 1777 -> 1777 bytes .../__pycache__/__init__.cpython-312.pyc | Bin 256 -> 256 bytes .../__pycache__/category.cpython-312.pyc | Bin 951 -> 951 bytes .../__pycache__/product.cpython-312.pyc | Bin 967 -> 958 bytes product/models/product.py | 2 +- .../__pycache__/__init__.cpython-312.pyc | Bin 303 -> 303 bytes .../category_serializer.cpython-312.pyc | Bin 770 -> 829 bytes .../product_serializer.cpython-312.pyc | Bin 1627 -> 1627 bytes product/serializers/category_serializer.py | 1 + .../__pycache__/__init__.cpython-312.pyc | Bin 171 -> 171 bytes product/tests/test_serializers/__init__.py | 0 .../__pycache__/__init__.cpython-312.pyc | Bin 0 -> 208 bytes .../test_category_serializer.cpython-312.pyc | Bin 0 -> 1243 bytes .../test_product_serializer.cpython-312.pyc | Bin 0 -> 1561 bytes .../test_category_serializer.py | 15 +++++++ .../test_product_serializer.py | 20 +++++++++ .../__pycache__/__init__.cpython-312.pyc | Bin 186 -> 186 bytes .../test_category_viewset.cpython-312.pyc | Bin 0 -> 2502 bytes .../test_product_viewset.cpython-312.pyc | Bin 4069 -> 4041 bytes .../tests_viewsets/test_category_viewset.py | 40 ++++++++++++++++++ .../tests_viewsets/test_product_viewset.py | 28 ++++++------ product/urls.py | 1 + product/viewsets/__init__.py | 1 + .../__pycache__/__init__.cpython-312.pyc | Bin 231 -> 288 bytes .../category_viewset.cpython-312.pyc | Bin 0 -> 873 bytes .../product_viewset.cpython-312.pyc | Bin 974 -> 934 bytes product/viewsets/category_viewset.py | 2 +- product/viewsets/product_viewset.py | 1 - 56 files changed, 130 insertions(+), 28 deletions(-) create mode 100644 order/tests/test_serializers/__init__.py create mode 100644 order/tests/test_serializers/__pycache__/__init__.cpython-312.pyc create mode 100644 order/tests/test_serializers/__pycache__/test_order_serializer.cpython-312.pyc create mode 100644 order/tests/test_serializers/test_order_serializer.py create mode 100644 product/tests/test_serializers/__init__.py create mode 100644 product/tests/test_serializers/__pycache__/__init__.cpython-312.pyc create mode 100644 product/tests/test_serializers/__pycache__/test_category_serializer.cpython-312.pyc create mode 100644 product/tests/test_serializers/__pycache__/test_product_serializer.cpython-312.pyc create mode 100644 product/tests/test_serializers/test_category_serializer.py create mode 100644 product/tests/test_serializers/test_product_serializer.py create mode 100644 product/tests/tests_viewsets/__pycache__/test_category_viewset.cpython-312.pyc create mode 100644 product/tests/tests_viewsets/test_category_viewset.py create mode 100644 product/viewsets/__pycache__/category_viewset.cpython-312.pyc diff --git a/bookstore/__pycache__/settings.cpython-312.pyc b/bookstore/__pycache__/settings.cpython-312.pyc index 5db735e5c84c69bb61daa03fb6150d2a1276973a..6a37da8421613afcc040ef2dee9e6ce32940b9d5 100644 GIT binary patch delta 169 zcmZ1@KUJ3RG%qg~0}!ZA@Je$Ln#d=?6vnhs!;gt4ogqbQ5n~irC6lK1W-sO@4(nf> zhDPRk20&=2$y_7`)KsJbB&rlrlM<74lk)Ski%as0QgssxGW9Z2i}JHe6AKFTlJj#l zWhe9SI0)b33U+l4at(?1c8$En>f-7Y>OMJ)=kMfr-Y6~?ph1j4Ts&*@Vcw~Xyq_c( N1pOHsd5fHYf&g|qEdKxi delta 334 zcmbO#yGEYxG%qg~0}$A@dZoP+oX97^B*(l_!;fil9iukC)@nwO90NlX2NOf8EJ#dT zJB4wL&T1xzI9#3+B&Vwj<7e4IKx=667TIAd5hJ>)hX0nld*^oXvQrO7cWOYcmH@tA0Pj4SC@DX|KO0|UyKTx@{{ek z9k_~AfQpJ#fyCrV+<$p)F=ytL++r;*$jL03+|LumcKB->=hehWQG|4!_GhdY3u$8(4wL1%;<`P2`%+ fH<9mxyy;~Dv+Dvj7X@r~1YZ_#Y~(F+1)2>2$rn@5 diff --git a/bookstore/__pycache__/urls.cpython-312.pyc b/bookstore/__pycache__/urls.cpython-312.pyc index e723a99f92d9bb9719c65846842ca8b42065b437..5338c856a31cb591705d4dfc6eadc4bafa5c5064 100644 GIT binary patch delta 20 acmX@geUzK~G%qg~0}yyVcHYRnixmJmNCkxe delta 20 acmX@geUzK~G%qg~0}zBo+iv9E#R>p7RRsh9 diff --git a/order/__pycache__/admin.cpython-312.pyc b/order/__pycache__/admin.cpython-312.pyc index 11a41534e6a85b87cbd7d66db70c7e723b79c00a..71bb81ca9bf63b09b824386e216bd220800ae5e1 100644 GIT binary patch delta 19 Zcmey(_?waYG%qg~0}yyVcAm)n0RTGP1?~U< delta 19 Zcmey(_?waYG%qg~0}zBo+fL;E001~^1#JKT diff --git a/order/__pycache__/factories.cpython-312.pyc b/order/__pycache__/factories.cpython-312.pyc index a72a47cd9fd12b58ef38238f49d34eaf1c4fb4ca..aea111b4d8ba7fe4ab45f4a9670d290d7ceff9a7 100644 GIT binary patch delta 532 zcmcc2dy1F$G%qg~0}%L3^GZ81k@t=StA9~SYLO=6Exv%F{FKt<61T+UlKi5|$&8GN zlkFI}blI2~+!<1sS{PE8S2KaMGB8B3SF&ib-r^1|PA!5ezr|WmSzJ;yc?XN`O-6yqTUp%VQLQUt0U5*xB9M#(aY4>2QUnsRKn!=iD5~qZ&|F_6JUNQh zPynnK$-K$4Sxr^hShYSgGqA~iU;?tf3ox>Zfm|vE@r4A?5>0NP_OGm}Dm?k1sL;#J zPf5)w2D|WF#rjO9LPqX zcWgGhGjlOA3QZ1T(Pz9lxrs%SQE>7a7Poj*i;Gx6hVp|5B;!F`kVA_UfrJbY!~G$O z>JKh7e-w#K4rDbH0P96EZ}KEoQ&m=0t@rwnpm*jO1wC#X-? po2YkP$oQg=@fQZ5z!w1?MzIOz)9ohOT^BaFC~WeT0Vn{r5dgKXcxM0r diff --git a/order/__pycache__/urls.cpython-312.pyc b/order/__pycache__/urls.cpython-312.pyc index 12fdf8a475794888a3eb555c5a4aa1f280c1b6c9..62b0d80eb3e56ba514af62b1a89d107dbdf0be36 100644 GIT binary patch delta 20 acmcb^a)*WcG%qg~0}yyVcHYPx$OHg8;RQJW delta 20 acmcb^a)*WcG%qg~0}zBo+iv6zWC8#c!81kG%qg~0}yyVc21L;$a@$7KS%}d delta 21 bcmcb>c!81kG%qg~0}zBo+onlQ)2GA_a&5 diff --git a/order/serializers/__pycache__/__init__.cpython-312.pyc b/order/serializers/__pycache__/__init__.cpython-312.pyc index add5d28acb988ead60d227d0504031c06f6380c1..ad967c927b207ec126c07fbf495e76069807733b 100644 GIT binary patch delta 21 bcmaFG_==JDG%qg~0}yyVc23iu$a@z6L&gSD delta 21 bcmaFG_==JDG%qg~0}zBo+otJFfW&l$$#+@ACtqUGV`Q4l$SNz( t4irQKHOy<6S2IEcCtI_IvuH9FNlu=^dYWT}<^=(j%K|2w)7kzr0s#E%7jOUo delta 93 zcmaDQ@JxXBG%qg~0}zBo+ooA;(>JmtkIamWj77{q764Y#JIMe5 literal 0 HcmV?d00001 diff --git a/order/tests/test_serializers/__pycache__/test_order_serializer.cpython-312.pyc b/order/tests/test_serializers/__pycache__/test_order_serializer.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fce5725e8e89d6b1f54abb2fc1987348370baeb0 GIT binary patch literal 1617 zcma)6O=uHA6rS0iWKGkiRSP!$5ItB|Xp54As06Y8Mu_6iWeF_X>_n^CY@OL2QWQM& z(1YNy9z9kns3-L#coo5*(z3K5C`iGB5WRTvz1jTK5X6Cf`+mOn!+US$ZGV4)!1?hY zUw)?$@&$#~(VI-;BruD_B`&QHk6M%>uT&IIwNy{DG%2eU-HTZ=EYDf@|JkaN6Tien}EoSRFW#tK7Zf1a7ZA8%50zx#S#drRjd}1wa zjhIRSx)+~``f0{FPBYxnlBr32w0BDZe!9v1%ZSY|1GW?aNNp^*y^d<@>h;43>?#e(4tDVVgH=X68nE40K$Yutnkokb7ipWc0&`xuD%2=x|?$_bz3h z<{sx>W?$!C<=!96e;mF5ki=SM;+gg$@jUS%b8JETWbAH04AOf?zJp~Er;CuT(`({) zDPUXoX%qeqb?FGmt|F<56p-yXcAz~c-`p*VKL3iY{S{r__)cWx{v92*NiT48T|eF!(DgixkO(T6M%d@x zbgI|=acl<1*DFlP?v0n_gF4NGyxh^{ABs$!0SI~9ql|mNxl_e&<9Jkbj_(5lPFm~& d@u{sZ{1Yu*3= literal 0 HcmV?d00001 diff --git a/order/tests/test_serializers/test_order_serializer.py b/order/tests/test_serializers/test_order_serializer.py new file mode 100644 index 0000000..6ed1588 --- /dev/null +++ b/order/tests/test_serializers/test_order_serializer.py @@ -0,0 +1,20 @@ +from django.test import TestCase + +from order.factories import OrderFactory, ProductFactory +from order.serializers import OrderSerializer + + +class TestOrderSerializer(TestCase): + def setUp(self) -> None: + self.product_1 = ProductFactory() + self.product_2 = ProductFactory() + + self.order = OrderFactory(product=(self.product_1, self.product_2)) + self.order_serializer = OrderSerializer(self.order) + + def test_order_serializer(self): + serializer_data = self.order_serializer.data + self.assertEqual( + serializer_data["product"][0]["title"], self.product_1.title) + self.assertEqual( + serializer_data["product"][1]["title"], self.product_2.title) diff --git a/order/tests/test_viewsets/__pycache__/__init__.cpython-312.pyc b/order/tests/test_viewsets/__pycache__/__init__.cpython-312.pyc index 9a5ab68078aef551ff1b29967965a24f59e2a293..c4de5a608865b84e1693fffba75d815795666a38 100644 GIT binary patch delta 19 ZcmdnaxSf&vG%qg~0}yyVcAm(+1^_V$1tI_d delta 19 ZcmdnaxSf&vG%qg~0}#0Wv!2Mk1^_Ww1u*~s diff --git a/order/tests/test_viewsets/__pycache__/test_order_viewset.cpython-312.pyc b/order/tests/test_viewsets/__pycache__/test_order_viewset.cpython-312.pyc index 6cf350f198769146da2a5bc848c202d4edd57d58..c47a36aa67a29c5f8b11dcedf175715e01270be6 100644 GIT binary patch delta 698 zcmYjPOKTHR6u!6f$~+sLr0F9~sI*Fa1S3fmLt3O(R0NAgkcx!RnP_6t33nzcn1yaM z3(*W04C2CyE<`s%UAgHG=*EQ$9Ss$<`%0=Vbm80?)Skt69^bj=p2Io6ho6qftFkNr zSE3J2mb$i_6Cu!mMpu~{J8z#G^Ifhg*OYntRt&QCQY643{i=>k-F`iRIT&Y|(@4{i z{bgK$4mXDkt+8M&AB5*&n3P6g0wRF{0)gdceLpBj;YVx?()bPA**gURxC!2?kxtgm zcBbv=Pm>os{iSFqCTrHdw&R%h$OSgtzgFz@4N;s(R9-Ub;1iK+psg z$+x#+r5``xRk#gbpbi>pU zJ|s+CKq;3@1QF*df98a1IgHk*)lH|btT{{_l@~2EPQrBEFfBxp+?@n=5ugbZJf6?b z6%OoA6=u%N9?8!hMLb>=hF}V>3zylXn_@2Ev*JW-F#4E#$bDldS?N(sP-xMc3gDHN zc31qYM(};{1pJCWh%=DIqtdaQ$_TyPAtr-H$XALB2^D!Qidv<(c*#gMP}THWaulSS zR-uH7HT{}_t{@uUlZMg^dC0op^c!UD$x?B_GEiAJ{h>GU2qvOz%zKLT+b#JgZ@4NU%I0i5iD*c!-n!H!Kf4KwW<-+`;V#{U2h C?4z&% delta 746 zcmZWnOKcKB7@lDtz%C1=P(V?d);=V*gpwjLh*kTDp2SK`Qx62$#jt{lvx|>dQ$5+E zn>mn16HV;Fn;JZMGM<`vG0}rrZR(}*T2u98j5Av`B%Q;z-}k>}|NoyS(O-L|w~{0P za?W4KRbH4 zM)GbmT$ixSZh1j4f?tZK;b;6?oP-=c>6r<2bHesPKbJ;PTE|Nu9zb#Y+!I`~e=2|! z-6&R2sjght(B*_dBw}eSN5B$gwRGi@mT01yZZ~E58#_x+RP0w#Rdi%8obKB4Y4nA3 zxa?ukomt+0d38-zNHNj2dh7(8mBv$anp+Hn@DmU>LEi>Aya{^0g4_m3uY>+|5c|$2 OVfy~9AAo%9cK!f@NVt^% diff --git a/order/tests/test_viewsets/test_order_viewset.py b/order/tests/test_viewsets/test_order_viewset.py index d8d3e2c..4695348 100644 --- a/order/tests/test_viewsets/test_order_viewset.py +++ b/order/tests/test_viewsets/test_order_viewset.py @@ -1,14 +1,14 @@ import json +from django.urls import reverse from rest_framework import status from rest_framework.test import APITestCase, APIClient -from django.urls import reverse -from product.factories import CategoryFactory, ProductFactory from order.factories import UserFactory, OrderFactory -from product.models import Product from order.models import Order +from product.factories import CategoryFactory, ProductFactory +from product.models import Product class TestOrderViewSet(APITestCase): @@ -23,7 +23,8 @@ def setUp(self): self.order = OrderFactory(product=[self.product]) def test_order(self): - response = self.client.get(reverse("order-list", kwargs={"version": "v1"})) + response = self.client.get( + reverse("order-list", kwargs={"version": "v1"})) self.assertEqual(response.status_code, status.HTTP_200_OK) @@ -48,10 +49,12 @@ def test_create_order(self): data = json.dumps( { "products_id": [product.id], - "user_id": user.id, + "user": user.id, } ) + print(data) + response = self.client.post( reverse("order-list", kwargs={"version": "v1"}), data=data, @@ -59,4 +62,5 @@ def test_create_order(self): ) self.assertEqual(response.status_code, status.HTTP_201_CREATED) + created_order = Order.objects.get(user=user) diff --git a/order/viewsets/__pycache__/__init__.cpython-312.pyc b/order/viewsets/__pycache__/__init__.cpython-312.pyc index 5d98afe0ed71c4935e2681aa435146de97ba5670..3eb660cbdbcc86145039dc2642199609be6fe167 100644 GIT binary patch delta 19 ZcmaFJ_>htNG%qg~0}yyVcAm(64FESA1)u-` delta 19 ZcmaFJ_>htNG%qg~0}zBo+fL-Z1^_gv1s?za diff --git a/order/viewsets/__pycache__/order_viewset.cpython-312.pyc b/order/viewsets/__pycache__/order_viewset.cpython-312.pyc index 8fa93d6a15295c5df2b7c06409c43c1f2daa6738..8f92765678e529e86b80b88a1ddcc587aea60bcd 100644 GIT binary patch delta 182 zcmeBXJ;cg)nwOW00SGQl@k(Q7oX9teiy6cPg3n14H#u8o2|{?tWD4VIMhHKOvyw@Z z`4*3VQA%o2SY~Q@aB9gdrpy#SO|Hp2i~$_^Ao2L5%E?iTMU1MG&oWB$U+34p$gjP^ zv~1V+@$w!C1g3HTfr_G)tpLk-%hSrYI?XpvEEr5FrR8esS33=BJeAq}mmU UPM*#r$E!TS<|_j;qcT_t08F_cM*si- diff --git a/order/viewsets/order_viewset.py b/order/viewsets/order_viewset.py index 5a92cd6..ad52962 100644 --- a/order/viewsets/order_viewset.py +++ b/order/viewsets/order_viewset.py @@ -7,4 +7,4 @@ class OrderViewSet(ModelViewSet): serializer_class = OrderSerializer - queryset = Order.objects.all() + queryset = Order.objects.all().order_by("id") diff --git a/product/__pycache__/admin.cpython-312.pyc b/product/__pycache__/admin.cpython-312.pyc index 784abddc0752278d4f00a66079810898a1eded60..bfb9952242bfd97501316a6be4f3dae1793e3f02 100644 GIT binary patch delta 20 acmbQrG?j__G%qg~0}yyVcHYR%#Rvc}fCOIv delta 20 acmbQrG?j__G%qg~0}zBo+iv9MVgvv!jRW2Q diff --git a/product/__pycache__/factories.cpython-312.pyc b/product/__pycache__/factories.cpython-312.pyc index 2663c483b9c097a208c911f70903fbd68fae9d99..817d3e2a4e5da876ec09c37a222bddcabc0ef03d 100644 GIT binary patch delta 20 acmbQtKbfEVG%qg~0}%ATb>7I`!43d5Fa=2f delta 20 acmbQtKbfEVG%qg~0}$Mr;tyG%qg~0}%X~;gyy!kyn!O*F^PhuT+jKVUQ>)NMTE5%MwEs1MyPW*08Q- zhKMsVFfpVurmzD^CZH)26A!4e@>X(aa!!2Z%*T*^x<>MHHwG E08X4J`~Uy| delta 91 zcmcb}`iO=1G%qg~0}zBo+olOmG%qg~0}#Yc@!H6}h8X}hTLm2e delta 20 acmdnazMY->G%qg~0}zBo+iv7u!wdj4lLXKJ diff --git a/product/models/__pycache__/product.cpython-312.pyc b/product/models/__pycache__/product.cpython-312.pyc index fb9b858f84e7b7b68bd34512c91a3fbcaf3b8ca0..ecdd6a1aa7015739f4f1f248634a6fd2e17a077c 100644 GIT binary patch delta 65 zcmX@kzK@;vG%qg~0}$v;@k(pl$m_+-&sR{CpHiA!qL-VWlA2RIIiJ}{O!*5NE2B+E RT7OPw&Q}H?vq%c42LNt+61e~X delta 74 zcmdnTew>~6G%qg~0}z~_?3C8Ek=Kh^LcE|TKczIeL@zf#B{ip5FFCO!H9fzma&j88 albFsIHdaQPjeyM z6l)4o3UdleCSxXJ6k8>$Cfj5&MqA+`kTJJ7ic$+pGmBDF-261zCx?%gY^>=s}NTQ+Xo&7N%;j*D?%?Q7+(-K>EtOA1*$0$ z2NHgoEJb`E4nK$xfC(3gfLLHvVv`-2q_{X(O+PUJi6YU-sZ60BNYX%szc_4i^HWN5 vQtgVQfm}u)E|vunAD9^#8SgTvJ!R1O!p6yHIz#%pq{&4|ldlXw4%l=69H~I7 delta 213 zcmdnX*2KnpnwOW00SLmPZPRQf@;*{$0`Y+0vjmWs&XCFw#hAhn#gxh%#gfjD!nlYr zinWqSlXIBIE diff --git a/product/serializers/category_serializer.py b/product/serializers/category_serializer.py index cfe2ff8..7da9ace 100644 --- a/product/serializers/category_serializer.py +++ b/product/serializers/category_serializer.py @@ -12,3 +12,4 @@ class Meta: "description", "active", ] + extra_kwargs = {"slug": {"required": False}} diff --git a/product/tests/__pycache__/__init__.cpython-312.pyc b/product/tests/__pycache__/__init__.cpython-312.pyc index e813dd51749e90032d156fe495b0d6fba26ae23b..822a00d8e2874e7db2a90954cfb937d83a7980f4 100644 GIT binary patch delta 19 ZcmZ3@xSEmsG%qg~0}yyVcAm(+001vd1pWX3 delta 19 ZcmZ3@xSEmsG%qg~0}#0Wv!2Mk001wX1q}cI diff --git a/product/tests/test_serializers/__init__.py b/product/tests/test_serializers/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/product/tests/test_serializers/__pycache__/__init__.cpython-312.pyc b/product/tests/test_serializers/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3904fb3557470053ca2b9008ae7472931343a0ed GIT binary patch literal 208 zcmX@j%ge<81XuUFr-A6lAOanHW&w&!XQ*V*Wb|9fP{ah}eFmxdmG5j76Iz^FR2-9= zSdx(%Z5r~UHjE~HWjEqIhKo$VyPCT#x literal 0 HcmV?d00001 diff --git a/product/tests/test_serializers/__pycache__/test_category_serializer.cpython-312.pyc b/product/tests/test_serializers/__pycache__/test_category_serializer.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d2adbf91d84bc0b91366c7ee33bc60d543bf5899 GIT binary patch literal 1243 zcmZ`&&1(}u6rb6TbZMK$TC8al8}OhDHejI^TJ>OC1rI^gf-DQmc4t!4?q=i6=8#gc zha7qkJhp#Ar5@_ZKSDeNEtRDO!Gm~Gh+cZ~&FQ4^+h2bdj15Wz0;uz|7QC0FufL-rIyiDcPTy_Au{NJ94zQ5uM-6z|J% z3}c|4(g(f^LC2x?nDSu3=2Vx$%z_=zRiD-G+D-shIP!q`q~-*P4CZIsCXXm9+irP- zGA9ljQz;QzIbe1WMFu9wkcdL0hGNJ>ZXiRcV_gl$u1yU~gcl-@ZaW%0EPAUi1N z=m>rz?I+SEvO52RHc)62t+kWsghQyuCxHW@I@0B0sFZx4K!s{h4qU1$OaZr0a}r2c zN{C}^(c+!@!AIfLEpd@V{`AGdoVg5IZhCg`l$wjaQ}bvg;3i$M9n*SfSBURf=8EsH zb3mC+5#L#-Y|8Pys?X_EiQ0i#je$1<=nju)&x^^AKDiXC^-$$BSgvkd?2m6D(rS<@ zp9Hdnj~`jhHhiRI zn_6~va_@X|;`+gjLv4N#wRHM4c$6H)4x(0 Np5J})8^IO%{sDnbI8Fcn literal 0 HcmV?d00001 diff --git a/product/tests/test_serializers/__pycache__/test_product_serializer.cpython-312.pyc b/product/tests/test_serializers/__pycache__/test_product_serializer.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1f7803cdfa6b15d9f24ec4c31956a68bc621d5e5 GIT binary patch literal 1561 zcma(RJx?4*bY{O;;0^@DGMuA;;sR|XkWP+_WIHKx?%d%F4EzKD(~&boo%p`Dc<+jy!U4QD3>P) zoL_&sy>X@y@;5TYF>_+@2@rdP5k^B2(FUbRYoQkD4Lvd%M#}4<8CeaB5{-OLn6X2c z$?1Wf#b}ImEobZnG7e4bZ@5%7UvfuFrfa_9o3ZGA<_8K;GWDg1Stn3A59Twu<0_bmOrbZ*m>b*(Z1im6kJT>bEH z{b~J4{m=JnyT)Jk;sCtKYpa2cOIPD}Aod813{BoR7mfdW3bw-mjvTfrqYJtol&6l4`;1h^%lgdklBtV7_J01Gq&C^49?{AALX zFdX&icO5@;G%<^s>Cw16G?M7Mv?S(Gc^Sv*ouA*<%EeQAi#gULzXkA!oK)UBu2lP# z>T%_IzjA$d`ou0B+w*;Uet)rdxxY|7ymn--ofEDd**Ay6lhT#_+x^mVkM>I+^w#>N zYlrSjosQS2xCBYyJF)~<9nq@8Z()00%a6F{B@><(!JiZ&UGh9^LZ%V#fS163=Qol@ zNG~sN`%*9lgv4I&kb!2J>vS+>nt8I+pzheoB)jjoHse)nfx!JrX7awRZlr%=lgsSU zrtfvGP>$L!)0dm2UBujYnY5HM`&L%@$Koo;@cqhn0sN~|N}rRZf5=DAN%hn!(;D6X K;w3?xdjAKDR&t>L literal 0 HcmV?d00001 diff --git a/product/tests/test_serializers/test_category_serializer.py b/product/tests/test_serializers/test_category_serializer.py new file mode 100644 index 0000000..f79b26f --- /dev/null +++ b/product/tests/test_serializers/test_category_serializer.py @@ -0,0 +1,15 @@ +from django.test import TestCase + +from product.factories import CategoryFactory, ProductFactory +from product.serializers import CategorySerializer + + +class TestCategorySerializer(TestCase): + def setUp(self) -> None: + self.category = CategoryFactory(title="food") + self.category_serializer = CategorySerializer(self.category) + + def test_order_serializer(self): + serializer_data = self.category_serializer.data + + self.assertEqual(serializer_data["title"], "food") diff --git a/product/tests/test_serializers/test_product_serializer.py b/product/tests/test_serializers/test_product_serializer.py new file mode 100644 index 0000000..2be469a --- /dev/null +++ b/product/tests/test_serializers/test_product_serializer.py @@ -0,0 +1,20 @@ +from django.test import TestCase + +from product.factories import CategoryFactory, ProductFactory +from product.serializers import ProductSerializer + + +class TestProductSerializer(TestCase): + def setUp(self) -> None: + self.category = CategoryFactory(title="technology") + self.product_1 = ProductFactory( + title="mouse", price=100, category=[self.category] + ) + self.product_serializer = ProductSerializer(self.product_1) + + def test_product_serializer(self): + serializer_data = self.product_serializer.data + self.assertEqual(serializer_data["price"], 100) + self.assertEqual(serializer_data["title"], "mouse") + self.assertEqual( + serializer_data["category"][0]["title"], "technology") diff --git a/product/tests/tests_viewsets/__pycache__/__init__.cpython-312.pyc b/product/tests/tests_viewsets/__pycache__/__init__.cpython-312.pyc index aa0b8d851d0bfed97d0161ae145bbb7f32d68b41..c085ab451796cb51fb4e82c46b77aa6f71516ca9 100644 GIT binary patch delta 19 ZcmdnRxQmhdG%qg~0}yyVcAm(+9sn_T1uFmm delta 19 ZcmdnRxQmhdG%qg~0}#0Wv!2Mk9sn`N1v&r# diff --git a/product/tests/tests_viewsets/__pycache__/test_category_viewset.cpython-312.pyc b/product/tests/tests_viewsets/__pycache__/test_category_viewset.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f9343ddc45e6472b64f311e18e312d51b0fef974 GIT binary patch literal 2502 zcmZ`*&2JM&6rcUF*Iy*m4%nEqkpiSvNKBxD7AR>N2>nt(G*qf(QdL!<7t<4PDkwQ{YyXE{Vv)+}7F48`LvIw93#Y!f>$O$ajN~_OX5P+w^XB(^ zJ5Q<_(EJ_*48HcK)r~0x^nV#b9 zz|_SLr;WT`vg{D3b2_u8RaoI{AG1`e!a(brRxN$eq}3TUXF&&3vNx4;9k`Nj4Vs5R zsS%xIIE`d@p6J3xYbhgY+;x(XG#;c+6F~Z_VoK^b`7Ezr{ZzMdTPzGT^w>58vBzu5}(bh{$wff#G*UFBhgy zW-l{HOtz?6SM=;zGgm1>W>{9AS94kAl3LQtqLOuXg+%DtGBveI&dOSlHs(rY8RBPp zYp8gxyy@|B)s|rSa(QLI%VF!pl{APe=E(PHcb}dG=+* zyRR`L&n(-IG|8JKn_r#)82Og2s&tVde^|w^7{#nnysT8%_T^j}35&W#G3|CpWq>B@ z+?N&AutP4Ll$@#Q)aNXJFgJHmIeO%Xa^YiJEHH2*8K$bi{yDQ`0q`j1%iUj~m@!)h z&tXhU%2U^n1;n&A#?9mF-V6Wv=ob@Nnh z^5*2DaP-E7d!PR#ZXJGiJA9@oaIyEeb@`c(1R@PNUYFyy;*G>uJu$Yq+(=K=(^K2> z`;X%LZwJ2*-g&z*e5^iv>|y+^^~e)B+_E3MQ>`Z^cJ?Lz7Px(bJA((XKeRJ4`or4Y zwZ_QF`pC%_0v9+fM=x%ny5)Y z6rTr}RZjD7%3gh4LvV&X>rTJQ_acOah;dpk8h9RnE^RvWg!5i+mrk$on}PO8g;&HR z6ylvPJWb;}et`p?;5pjRu1%JN0$`_ z&AtNx)wwVF?aEgxw@%#oWNY8V!@i^I;uDuIjp%SaI^4yWo!tXFiP2|%54(YbEjiw1&{iVVNTlnD^n?As$Y&gy z%%)^pR+N%j)D^`JDoPO^CLEI7Lg|1kI>$`m3;gCAGL4deHA43hxhI5dY@@Y2> vXXraHhmSo&pga>ej{A*-o{~3yC&wR?k*8$rF&X~HH^@!iSb9OAb2j-GTevP` literal 0 HcmV?d00001 diff --git a/product/tests/tests_viewsets/__pycache__/test_product_viewset.cpython-312.pyc b/product/tests/tests_viewsets/__pycache__/test_product_viewset.cpython-312.pyc index e298ec0dd3092578467b2e12b197d00ef448e9a4..fb0eeee52aaacf70f25d222f9839b8090428b447 100644 GIT binary patch delta 1367 zcmZ`(O>7%Q7@gT4@7n9JH;t1tq#rH39IC@Rqig%dv~f)c5fdO;lFgpjIMt<*5s>WKpvR2n$-!pu605fXEF^JeFp znQy-LW`7;{aRB{qxoEF>EF|Q5rdM^hZ=Ic2 z7O`Vh^WH+9?-VrQh#bDi$PTbU4q6~52*4Kij;3;w1+RmgYzYiQmdH>cmtY!xM?Qqf zGg7csDHO1FUkbN*z-nYB+?C#kd$9H8Dy+eh7R(Z=9l53X>RQ7nyTz>6A@=(~CiZSNSGPnjB zi2*WSmu`d`de;uxMvwI5eLcCGyk&f2+|!c}^jGTgfr@TMwjwv8cXq^rc#$W7k1?R) zitYJHQMKyYc+ITXEFoV9sjNyHs4YH!zo$YNpE~z07-6vrM&?QpL$qBXo5_tC;J-F&QBJ0&)@d$rCxg&ojw#{ zVy3P>34t&o74-+`-5C$}LGpRHXS0{B{7>`xf)AErsaCiM_al2p_Na-LwjT`)c~z=` zQhyNL?rT!%`SvJa-eAB=LjfbV<%HlRiLOlyqknuL|IfB^X@uyJ1gU8V_LC*eh|57@ z5NrS=M!wfxCn$Puv&(mcF9?2t9oBM*!P#jJDGuD}SmiLrfXY_2vhGr$Xi;h1aXnuf z{1Tr}b5MAY{$@72xO`@8e0gpuGn>tv!`!fKaf}exrH2W_qt!gK;fjMd@T)v(g8Uve zl@UhWXMnte=F*MMp$DDGy4r|$-n_DP<)C|Tck*E9^w+7cQeXD}Awo2ED2jTdEuf1{EWIkx^(T0r;;j1o+hGl z79O5R$W!<^9*7ti$EaqN%(WFKUBzV=i$sVILy1hsdpBhs#5bog%zi4%17%Q6rR~1@7kMPC-EOipl;ICVGFczXqvPVh1Q7#La9P(1aehbi+5d|*j{&L z404pJ2=(Afi}xgiup1Js@T_Hf0XqeDmI$ zd9&|*v)?6uP3qt4dI+%b@Qc&McUN^YQ4w+i1U9gRvRILFlF!BR>fD)Vs3r1H0CIf| z)zp6HboIB%%W~FTa;hfulzHUZ^#U;kPdhdLQr5vFV`0Y&vPGs`a;k&}A?GazVTaKG zCKjpVGX;K9cfbzW-N(pv;D8*oK~AvY6_68cfuUrJ4CRJo%3gogp%-Baenr>dXiDxL z(&~^Eknh|X0HSt`G%cC58jL@-0b8AHEKcd}C4Dq448S0LS$KXvgo4cO1q%N45l?`^ z90J^|xNj^v1%jC$ITmp|neb8|$#>Q|)qtLaopKTLTy$HwdO~LeXBfN#cH&98)ReAi zJJBSaV3QB{+}K zkCitSPH`C0aeabLsl)M4rq)kx9=~PZK7DrkKz1wgYE!+Z_E4;T4X@pt3J$?uGQhU@ z!&X+rmOz)KZ z$OwHXrv#Fs|Ad|m8{LLplKC$Bf)=CiX;E6z4Ct@mA^N^H48!zu?WDe}%~-_Rk6Go? zC+MHr%;mV>R}^7s(32eeUYnfpLZd?*p5nk|g^n=rWV>FeVNWR8o?JtvD)FS6i;3R? z^fV89hJ(gqdtc0E=kpWe>3n8k_EdIu265T_*Moh)40P(xqtyb_)CCtc&@_*lptpJ~ zWt34Y@SbEQe~FB2MMj(IPB`+x^3~-Z=k$aH@y`iTRIT~uJe;Kr<#^}%bD=D^@4l2j+oO|vVqvYBws{U#d+IBOMWrY5n2u(HSdDw+F+~=(rqwu b7aVJYWE%|s1hfZ%aX7s;^fzFWf9-z(=EpXR diff --git a/product/tests/tests_viewsets/test_category_viewset.py b/product/tests/tests_viewsets/test_category_viewset.py new file mode 100644 index 0000000..5a7d755 --- /dev/null +++ b/product/tests/tests_viewsets/test_category_viewset.py @@ -0,0 +1,40 @@ +import json + +from django.urls import reverse +from rest_framework.test import APIClient, APITestCase +from rest_framework.views import status + +from product.factories import CategoryFactory +from product.models import Category + + +class CategoryViewSet(APITestCase): + client = APIClient() + + def setUp(self): + self.category = CategoryFactory(title="books") + + def test_get_all_category(self): + response = self.client.get( + reverse("category-list", kwargs={"version": "v1"})) + + self.assertEqual(response.status_code, status.HTTP_200_OK) + category_data = json.loads(response.content) + + self.assertEqual(category_data["results"] + [0]["title"], self.category.title) + + def test_create_category(self): + data = json.dumps({"title": "technology"}) + + response = self.client.post( + reverse("category-list", kwargs={"version": "v1"}), + data=data, + content_type="application/json", + ) + + self.assertEqual(response.status_code, status.HTTP_201_CREATED) + + created_category = Category.objects.get(title="technology") + + self.assertEqual(created_category.title, "technology") diff --git a/product/tests/tests_viewsets/test_product_viewset.py b/product/tests/tests_viewsets/test_product_viewset.py index a943941..ac6eddc 100644 --- a/product/tests/tests_viewsets/test_product_viewset.py +++ b/product/tests/tests_viewsets/test_product_viewset.py @@ -1,19 +1,20 @@ -from product.factories import CategoryFactory, ProductFactory -from order.factories import UserFactory +from django.urls import reverse from rest_framework.authtoken.models import Token -from product.models import Product from rest_framework.test import APITestCase, APIClient -from django.urls import reverse from rest_framework import status +from product.factories import CategoryFactory, ProductFactory +from order.factories import UserFactory +from product.models import Product import json class TestProductViewSet(APITestCase): - + client = APIClient() + def setUp(self): - self.client = APIClient() self.user = UserFactory() - self.token = Token.objects.create(user=self.user) + token = Token.objects.create(user=self.user) + token.save() self.product = ProductFactory( title="pro controller", @@ -22,8 +23,10 @@ def setUp(self): def test_get_all_product(self): token = Token.objects.get(user__username=self.user.username) - self.client.credentials(HTTP_AUTHORIZATION="Token " + token.key) - response = self.client.get(reverse("product-list", kwargs={"version": "v1"})) + self.client.credentials( + HTTP_AUTHORIZATION="Token " + token.key) + response = self.client.get( + reverse("product-list", kwargs={"version": "v1"})) self.assertEqual(response.status_code, status.HTTP_200_OK) product_data = json.loads(response.content) @@ -35,19 +38,16 @@ def test_get_all_product(self): def test_create_product(self): token = Token.objects.get(user__username=self.user.username) self.client.credentials(HTTP_AUTHORIZATION="Token " + token.key) - category = CategoryFactory() data = json.dumps( - {"title": "notebook", "price": 800.00, "categories_id": [category.id]} + {"title": "notebook", "price": 800.00, + "categories_id": [category.id]} ) - print("Data sent1:", data) - response = self.client.post( reverse("product-list", kwargs={"version": "v1"}), data=data, content_type="application/json", - # content_type='json' ) self.assertEqual(response.status_code, status.HTTP_201_CREATED) diff --git a/product/urls.py b/product/urls.py index d4484f7..381f1c0 100644 --- a/product/urls.py +++ b/product/urls.py @@ -5,6 +5,7 @@ router = routers.SimpleRouter() router.register(r"product", viewsets.ProductViewSet, basename="product") +router.register(r"category", viewsets.CategoryViewSet, basename="category") urlpatterns = [ path("", include(router.urls)), diff --git a/product/viewsets/__init__.py b/product/viewsets/__init__.py index ab3446c..a68317b 100644 --- a/product/viewsets/__init__.py +++ b/product/viewsets/__init__.py @@ -1 +1,2 @@ from .product_viewset import ProductViewSet +from .category_viewset import CategoryViewSet diff --git a/product/viewsets/__pycache__/__init__.cpython-312.pyc b/product/viewsets/__pycache__/__init__.cpython-312.pyc index bd4047dd92d894ea9e91e8072d799fcc3a590469..681cce64c93845e9f455562d4684ff2aca97a856 100644 GIT binary patch delta 182 zcmaFPxPXcGG%qg~0}y4BO~Ko2JL$cxu_y81O^9B4@=bQv6d&w+zj=S=z4^WU(rBy!%Bzphy3Yx~cYP?u zF2G_J!2}pEA|NI{AsQRPh)v&IVpCYL?b`$lcnZuK1G71qnt8on8CBfsPknGnR)3K& zE?)QeNt>s5uI+^>KTPBZ@wF1Sx$K3acgkgy-;rw^a4CzMXePkHCk%Xpo4&=!7<_wV zxMt>*w-imHvP{?Nne?{^P)#63olD;+(aQEq239VZ7Pw!%;w&H|)1p@!Tw^~odd#(? zh0&~Rc3}lWVJ*xE@?+U+EQF}m9D#cd9e2|I8a=wAP&PwBa{eOB9EU>5AVm8?eTAdESs*&3xW z&LcFgQ*0TEJR&ud*#$1hsuC)VjbTHhC}8d`9ufvCI;TGLy@g75P~iO(w*AWdKq|f Date: Wed, 22 May 2024 20:16:21 -0300 Subject: [PATCH 16/19] =?UTF-8?q?Sinalizando=20requirements.txt=20para=20e?= =?UTF-8?q?xerc=C3=ADcio=20EBAC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- requirements.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/requirements.txt b/requirements.txt index dc60196..9783973 100644 --- a/requirements.txt +++ b/requirements.txt @@ -53,3 +53,5 @@ trove-classifiers==2024.4.10 tzdata==2024.1 urllib3==2.2.1 virtualenv==20.26.1 + +# Exercício EBAC Build From 3ba5c53c6ef71e2a35760e43681b875fafe051db Mon Sep 17 00:00:00 2001 From: matheus-dev-fullstack Date: Thu, 23 May 2024 19:02:08 -0300 Subject: [PATCH 17/19] =?UTF-8?q?Teste=20de=20automa=C3=A7=C3=A3o=20de=20C?= =?UTF-8?q?ode=20Review?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/workflow-pr.yml | 38 +++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/workflow-pr.yml diff --git a/.github/workflows/workflow-pr.yml b/.github/workflows/workflow-pr.yml new file mode 100644 index 0000000..b94c0ba --- /dev/null +++ b/.github/workflows/workflow-pr.yml @@ -0,0 +1,38 @@ +name: Python Pull Request Workflow +on: [pull_request] +jobs: + + qa: + name: Quality check + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v1 + - name: Set up Python + uses: actions/setup-python@master + with: + python-version: 3.8 + - name: Install poetry + run: | + pip install -U pip + pip install poetry + poetry install + env: + POETRY_VIRTUALENVS_CREATE: false + + - name: View poetry --help + run: poetry --help + + - name: Install dependencies + shell: bash + run: python -m poetry install + + - name: Test + run: | + poetry run python manage.py test + - name: Wemake Python Stylguide + uses: wemake-services/wemake-python-styleguide@0.16.0 + continue-on-error: true + with: + reporter: 'github-pr-review' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file From d7335af68eb08e16279898f5c7535178db89e111 Mon Sep 17 00:00:00 2001 From: matheus-dev-fullstack Date: Thu, 23 May 2024 19:19:01 -0300 Subject: [PATCH 18/19] =?UTF-8?q?Exerc=C3=ADcio=20EBAC=20Integra=C3=A7?= =?UTF-8?q?=C3=A3o=20Cont=C3=ADnua?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/workflow-pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/workflow-pr.yml b/.github/workflows/workflow-pr.yml index b94c0ba..779af10 100644 --- a/.github/workflows/workflow-pr.yml +++ b/.github/workflows/workflow-pr.yml @@ -1,7 +1,7 @@ +# Exercício EBAC - Github Actions and Code Review Automation name: Python Pull Request Workflow on: [pull_request] jobs: - qa: name: Quality check runs-on: ubuntu-18.04 From 62f77367f8a33d71cd4e51ac6392e593e2b00079 Mon Sep 17 00:00:00 2001 From: matheus-dev-fullstack Date: Thu, 30 May 2024 13:16:08 -0300 Subject: [PATCH 19/19] Ajustando README.md --- README.md | 45 +++++++++++++++++++++++++++++++++++++++++++++ README.me | 18 ------------------ 2 files changed, 45 insertions(+), 18 deletions(-) create mode 100644 README.md delete mode 100644 README.me diff --git a/README.md b/README.md new file mode 100644 index 0000000..1e89d8b --- /dev/null +++ b/README.md @@ -0,0 +1,45 @@ +# Bookstore + +Bookstore APP from Backend Python course from EBAC + +## Prerequisites + +``` +Python 3.5> +Poetry +Docker && docker-compose +``` + +## Quickstart + +1. Clone this project + + ```shell + git clone git@github.com:drsantos20/bookstore.git + ``` + +2. Install dependencies: + + ```shell + cd bookstore + poetry install + ``` + +3. Run local dev server: + + ```shell + poetry run manage.py migrate + poetry run python manage.py runserver + ``` + +4. Run docker dev server environment: + + ```shell + docker-compose up -d --build + docker-compose exec web python manage.py migrate + ``` + +5. Run tests inside of docker: + + ```shell + docker-compose exec web python manage.py test \ No newline at end of file diff --git a/README.me b/README.me deleted file mode 100644 index e733b6b..0000000 --- a/README.me +++ /dev/null @@ -1,18 +0,0 @@ -# Scripts do Projeto: - -Git clone ... - -## Criando Ambiente Virtual: -python -m venv env -env/scripts/activate - - - -## Instalação das dependências do Projeto: -pip install -r requirements.txt - -## Build Docker: -* Abrir o Docker e digitar no terminal -docker run -docker-compose up --build -