You Just wrote Flask Rest API How to write a Unit Test for Rest API in Python

Поделиться
HTML-код
  • Опубликовано: 27 окт 2024

Комментарии • 35

  • @denisdenia
    @denisdenia 2 года назад +8

    A test is not a unit test if:
    It talks to the database
    It communicates across the network
    It touches the file system
    It can't run at the same time as any of your other unit tests
    You have to do special things to your environment (such as editing config files) to run it.

    • @brendon205
      @brendon205 2 года назад

      yep, that was an integration test in the video

  • @karlduckett
    @karlduckett 4 года назад +7

    Nice video - love Flask! Great tutorial - easy to follow, please type slower with a quieter keyboard :)

  • @soumyasouravpatnaik2246
    @soumyasouravpatnaik2246 3 года назад +2

    First off, this is a nice video. It clearly looks like you have the code in the notepad(Screen-2) and you are just typing it out on Screen-1. you have write it from scratch then it will make sense.

    • @carkod
      @carkod 3 года назад

      I don't that really matters, as long as he doesn't make a lot of mistakes. But he could have done all the code in one single function, no need to create 3 with the same content

  • @anofor4932
    @anofor4932 3 года назад +2

    This was exactly what I needed. Thank you so much.

    • @sscip88
      @sscip88 2 года назад

      same here!

  • @ashrith.suresh
    @ashrith.suresh 3 года назад +1

    Really helpful! Thanks for making this!

  • @manasacharya8944
    @manasacharya8944 3 года назад +2

    Really helpful and easy to understand! Thank you!

  • @chrisc9716
    @chrisc9716 2 года назад

    Thanks for the tutorial sir. Works work and exactly what I was looking for to 'getting started' with my unit testing in Flask. Have a good day.

  • @lucaslukasavicussilva30
    @lucaslukasavicussilva30 2 года назад

    Simple and very helpful! Congratulations!

  • @manojkumar-hr7tj
    @manojkumar-hr7tj Год назад

    Very helpful!!

  • @the1stchircea730
    @the1stchircea730 3 года назад +4

    Don't mean to be rude or anything but why are you using try catch for the imports ? I mean you get a specific error for each import issue either way

  • @new_artiko
    @new_artiko 2 года назад

    bro, you are amazing!

  • @kristiyanivanov608
    @kristiyanivanov608 3 года назад +1

    Dude, are you trying to kill the space button?

  • @sandeepkorupolu8413
    @sandeepkorupolu8413 3 года назад +1

    Bro..also if we do crud operations...can u explain how to perform unit testing for crud operations in Flaskapi where as student database created in it

  • @reinhartuntoro2826
    @reinhartuntoro2826 11 месяцев назад

    Sir, do you have the GitHub repository in the video? Thanks

  • @sushruthbhat5727
    @sushruthbhat5727 3 года назад +1

    I get this error.. "AssertionError: 'text/html; charset=utf-8' != 'application/json'" any idea why ??

    • @LWeRNeO
      @LWeRNeO 2 года назад

      user follow_redirects=True in response. You want to get to the response of the server, to get you json content.

  • @alonsom.donayre1992
    @alonsom.donayre1992 4 года назад

    Nice video, i have a doubt , why dont use Flask_testing? is deprecated ? or unittest is more solid?

  • @sainaveen5659
    @sainaveen5659 Год назад

    can we write the same without using classes?/

  • @venvanman
    @venvanman 2 года назад

    that poor keyboard taking a shit ton of abuse

  • @leka1b901
    @leka1b901 3 года назад

    Super good wow amazing job

  • @haneulkim4902
    @haneulkim4902 3 года назад

    Thanks for amazing video. where is /fo route? so if I have only one route say /predict in my flask code would be `response = tester.get("/predict")`?

    • @yugaank100
      @yugaank100 3 года назад

      depends, if its a post request or get request and if you need to send some data you'll need to use requests library

  • @FalconsViewpoint
    @FalconsViewpoint 2 года назад

    😍

  • @jdotsystem
    @jdotsystem 4 года назад

    Does way to this unit test follow DevOps?

  • @leniedor733
    @leniedor733 Год назад

    This way you will deploy both you app and your test which is not good

  • @dmitriyengineer2441
    @dmitriyengineer2441 2 года назад

    Really good guide, 99% like.
    +1% if you share an example on git and pin to video)

  • @muhammadnajibuddinjodiansy2497
    @muhammadnajibuddinjodiansy2497 2 года назад

    youre lit bro

  • @haneulkim4902
    @haneulkim4902 3 года назад

    I am building a restAPI using flask to call by myself. What is the need for unittesting when I am the one calling the API (meaning I will put correct inputs, datatypes, etc...)?

  • @rabinpradhan5603
    @rabinpradhan5603 3 года назад

    can anyone tell me where does this test_client came from in the test line number 13 at time 4 minutes 10 second

  • @lokeshv007
    @lokeshv007 4 года назад

    very good

  • @rabinpradhan5603
    @rabinpradhan5603 3 года назад

    can anyone tell me where does this test_client came from in the test line number 13 at time 4 minutes 10 second