wrmacdonald / gift-app

1 stars 0 forks source link

improvements to test_user #60

Closed mgnielsen1 closed 1 year ago

mgnielsen1 commented 2 years ago

added improvements to user_tests to reduce code duplication & improve randomization of tests

added decorator: @pytest.mark.parametrize('exec_number', range(Config.NUM_TEST_EXECUTIONS)) to no-input tests to set them to run multiple times (set to 3 inside config.py)

added random integer for check_not_exist and get_all tests

added FakeUserInfo to reduce duplicated code

condensed test_update_user tests into single test by using @pytest.mark.parametrize decorator & sending dictionaries as inputs

removed test_user_old.py

all tests are passing

mgnielsen1 commented 2 years ago

Yea, good point, I’ll change the range on it so it has a relatively high minimum value

On Thu, May 12, 2022 at 8:00 PM wrmacdonald @.***> wrote:

@.**** approved this pull request.

Hey, you got parameterizing working! :D

In tests/test_user.py https://github.com/wrmacdonald/gift-app/pull/60#discussion_r871960377:

     """

check that user_id 5000 does not exist """

  • id = 5000
  • id = random.randint(1, 100000)

If id was < 10 or so, wouldn't there be a chance there'd be a user with that id? We're not deleting out all the users before checking.

— Reply to this email directly, view it on GitHub https://github.com/wrmacdonald/gift-app/pull/60#pullrequestreview-971650275, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANESLJ5EA66UAP54E2PEMF3VJXATVANCNFSM5VZTNWFA . You are receiving this because you authored the thread.Message ID: @.***>