Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated website view tests #78

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

jeremiahbrem
Copy link
Contributor

I updated the website views test cases with the changed post endpoint name, different phone numbers, and updated success message.

@jeremiahbrem
Copy link
Contributor Author

Run tests with 'python manage.py test'

Copy link
Collaborator

@syk1112 syk1112 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but the test case for test_form_data_view_scheduled fails now because I believe the case's arraignment date is in the past and as such cannot be setup for reminder. Can you choose a different case number?

@jeremiahbrem
Copy link
Contributor Author

I can, or I can implement some mocking so we don't have to rely on actual case data, which changes.

@jeremiahbrem
Copy link
Contributor Author

Actually, I'm not sure how to mock a request made within another request. I can just change the case number for now.

@jdungan
Copy link
Member

jdungan commented Aug 5, 2020

Actually, I'm not sure how to mock a request made within another request. I can just change the case number for now.

The trick to mocking calls from inside another request is to mock it with the full context from where it is being called:

e.g.



some_module.py
from some_library import some_function

def another_function():
    return some_function()

test.py
import some_module

@mock.patch('some_library.some_function')
def test_one(self):
    result = some_library.another_function()

hope this helps.

@jeremiahbrem
Copy link
Contributor Author

Awesome, thanks jdungan. I'll get to work on that and commit again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants