Тёмный

Django Testing Tutorial - Testing Views #3 

The Dumbfounds
Подписаться 13 тыс.
Просмотров 79 тыс.
50% 1

In this video you will learn how to test our views by sending requests using the Django test client.
7 Tips For Getting Better At Django:
mailchi.mp/dea...
Get the starting point on GitHub:
github.com/The...
If you enjoyed this video, make sure to subscribe and share it with anyone you think could enjoy it as well.
I hope to see you inside of the next episode,
Cheers.

Опубликовано:

 

5 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 40   
@krichevskoy
@krichevskoy 2 года назад
very nice QOL changes, me and my group working on our project using this hehe
@sep69
@sep69 Год назад
Thank you very much for this great video series ! I just started with django tests and this is a great help. Thanks again :)
@SheezZarR
@SheezZarR 5 лет назад
Thanks for the tutorial, It's very helpful for a beginner.
@mkrtichhovhannisyan6244
@mkrtichhovhannisyan6244 3 года назад
It worked for me perfectly. Thank you.
@rahulhindocha
@rahulhindocha 3 года назад
Hey man...great content. Good explanations given by you. But I had a doubt. You were creating some objects of different models in the tests. Are these objects also created in our database or they are just for testing only?
@ilyasjumadurdyew8074
@ilyasjumadurdyew8074 2 года назад
When you run tests django creates or re-creates test database wich is set in settings.py, though your real db won't be affected
@BYunus1903
@BYunus1903 Год назад
@@ilyasjumadurdyew8074 Great answer!
@basharatmir4025
@basharatmir4025 Год назад
Thank u so much, helped
@aizhang9919
@aizhang9919 4 года назад
best tutorial ever!
@N63B44TÜ
@N63B44TÜ 4 года назад
Thx a lot, great like always!
@thedumbfounds767
@thedumbfounds767 4 года назад
You're welcome!
@Jambajakumba
@Jambajakumba 3 года назад
Thanks man!!! Keep up the good work
@RafaelGuedes84
@RafaelGuedes84 Год назад
Thanks, man! This was really helpful.
@Thedevineforce
@Thedevineforce 3 года назад
@The Dumbfounds Please link the exact github project path to the code you are using in the tutorial
@mohitsharma2376
@mohitsharma2376 4 года назад
where did that "expenses" come from in "self.assertEquals(self.project1.expenses.first().title, 'expense1')"
@alanwatts8669
@alanwatts8669 4 года назад
Really nice!
@Yoyo-gf3oi
@Yoyo-gf3oi 5 лет назад
I thought this would come in handy, however you dont really explain what is happening, what each part does etc. This is just a video of someone writing code and narrating what he writes but without any explanation. Its great if the person wants to copy/paste and not understand, but for the long term thinkers, no explanation mean no understanding. Thumbs down
@САМГАДсамгадович
@САМГАДсамгадович 3 года назад
you should have some background first, i`d advice you to read the official DJ tutorial for begginers, there is testing part and everything is clear for begginers
@shaiksameercse
@shaiksameercse 2 года назад
It's pretty clear if you have some experience with Django and unit testing. It's not meant for beginners so you can skip this one.
@mrpreseclips7991
@mrpreseclips7991 3 года назад
Hello i wonder why pycharm throw me “ reverse for ‘list’ not found
@jg9193
@jg9193 4 года назад
Tutorials on testing are hard to come by
@ProSimples
@ProSimples 4 года назад
I've got this error: postgres' database and will use the first PostgreSQL database instead. warnings.warn( Got an error creating the test database: permission denied to create database I dont know how to fix... :\. Django 3
@sagarpotnis1215
@sagarpotnis1215 2 года назад
for testing just switch to dbsqlite database and try.. it worked for me
@ProSimples
@ProSimples 2 года назад
@@sagarpotnis1215 yes we’ve done this approach. Thank you.
@TruthSeekerClub
@TruthSeekerClub 2 года назад
hey man, in post expenses you added the body to client.post(url, {content}) but you have not create an object from it. so how the expense was created? and how it was added to the project! why did it work without creating object and add it to db with relation to project1
@vijaysinhparmar
@vijaysinhparmar 4 года назад
whats your urls file?
@adambabs6582
@adambabs6582 4 года назад
I am doing it the exact same way and I am getting: AssertionError: 302 != 200
4 года назад
Try adding the following: def setUp(self): self.client = Client() self.user = User.objects.create_superuser('test_admin', '', 'test_admin') self.client.login(username='test_admin', password='test_admin')
@ankitasoni527
@ankitasoni527 3 года назад
have you got the solution i am getting the same error
@MahmoudGamal-xe9rv
@MahmoudGamal-xe9rv 5 лет назад
200 = mean first check at code 200 and if i have article and i want test 1000 . just replace 200 by 1000 ?
@thedumbfounds767
@thedumbfounds767 5 лет назад
Sorry, could you rephrase the question?
@MahmoudGamal-xe9rv
@MahmoudGamal-xe9rv 5 лет назад
@@thedumbfounds767 I want to make test for users in database and if database can contain more than 10000 user or not ?
@thedumbfounds767
@thedumbfounds767 5 лет назад
​@@MahmoudGamal-xe9rv Well, by default, it should be able to contain 10.000 users and many more :)
@MahmoudGamal-xe9rv
@MahmoudGamal-xe9rv 5 лет назад
@@thedumbfounds767 good my question is 200 any relation by default number of users
@thedumbfounds767
@thedumbfounds767 5 лет назад
@@MahmoudGamal-xe9rv 200 is the status code of the response. It means that everything was okay.
@cooller8888
@cooller8888 Год назад
dude this extra function is so dull, why just why.... totally ruined the progress for me, why would anybody wanna do such nonsense....
Далее
Бекенд на Django, Урок 2: Unit Tests
44:15
Python Django REST API In 30 Minutes - Django Tutorial
30:42
Intro to Python Mocks | Python tutorial
18:42
Просмотров 85 тыс.
Stop Writing So Many Tests
10:02
Просмотров 91 тыс.
DjangoCon 2022 | factory_boy: testing like a pro
27:09
Просмотров 3,3 тыс.