Django Testing Tutorial - Testing Views #3

Поділитися
Вставка
  • Опубліковано 3 гру 2024

КОМЕНТАРІ • 41

  • @errzrah
    @errzrah Місяць тому

    I was struggling with testing my django apps but this playlist really helped me out. Thank you!💯

  • @sep69
    @sep69 Рік тому +2

    Thank you very much for this great video series ! I just started with django tests and this is a great help. Thanks again :)

  • @krichevskoy
    @krichevskoy 2 роки тому +2

    very nice QOL changes, me and my group working on our project using this hehe

  • @SheezZarR
    @SheezZarR 5 років тому +4

    Thanks for the tutorial, It's very helpful for a beginner.

  • @mkrtichhovhannisyan6244
    @mkrtichhovhannisyan6244 3 роки тому +1

    It worked for me perfectly. Thank you.

  • @aizhang9919
    @aizhang9919 4 роки тому +2

    best tutorial ever!

  • @RafaelGuedes84
    @RafaelGuedes84 Рік тому

    Thanks, man! This was really helpful.

  • @basharatmir4025
    @basharatmir4025 Рік тому +1

    Thank u so much, helped

  • @Jambajakumba
    @Jambajakumba 4 роки тому +1

    Thanks man!!! Keep up the good work

  • @N63B44TÜ
    @N63B44TÜ 5 років тому +4

    Thx a lot, great like always!

  • @rahulhindocha
    @rahulhindocha 3 роки тому +8

    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 роки тому +6

      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!

  • @alanwatts8669
    @alanwatts8669 4 роки тому +1

    Really nice!

  • @Thedevineforce
    @Thedevineforce 3 роки тому +2

    @The Dumbfounds Please link the exact github project path to the code you are using in the tutorial

  • @mohitsharma2376
    @mohitsharma2376 5 років тому +2

    where did that "expenses" come from in "self.assertEquals(self.project1.expenses.first().title, 'expense1')"

  • @mrpreseclips7991
    @mrpreseclips7991 3 роки тому +1

    Hello i wonder why pycharm throw me “ reverse for ‘list’ not found

  • @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 роки тому +2

    whats your urls file?

  • @ProSimples
    @ProSimples 4 роки тому +3

    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 роки тому +1

      for testing just switch to dbsqlite database and try.. it worked for me

    • @ProSimples
      @ProSimples 2 роки тому +1

      @@sagarpotnis1215 yes we’ve done this approach. Thank you.

  • @MahmoudGamal-xe9rv
    @MahmoudGamal-xe9rv 5 років тому +1

    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 років тому +3

      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 років тому +2

      ​@@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 років тому +2

      @@MahmoudGamal-xe9rv 200 is the status code of the response. It means that everything was okay.

  • @jg9193
    @jg9193 4 роки тому +1

    Tutorials on testing are hard to come by

  • @Yoyo-gf3oi
    @Yoyo-gf3oi 5 років тому +21

    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 роки тому +1

      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 роки тому +1

      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.

  • @adambabs6582
    @adambabs6582 4 роки тому +1

    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 роки тому +1

      have you got the solution i am getting the same error

  • @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....