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

Fix 404 redirect #887

Merged
merged 2 commits into from
Nov 9, 2022
Merged

Fix 404 redirect #887

merged 2 commits into from
Nov 9, 2022

Conversation

sblaisot
Copy link
Contributor

@sblaisot sblaisot commented Nov 7, 2022

This PR fixes 404 redirect by replacing hardcoded redirect URI with configured redirect URI, should it exist in configuration.

I also simplified how redirect_uri is retrieved from configuration with getter and default value.

Copy link
Contributor

@shankari shankari left a comment

Choose a reason for hiding this comment

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

Code changes look fine to me.

@sblaisot thanks for the contribution!
Can you also indicate the testing done, potentially with a small video since there is not a unit test for this functionality?

@shankari
Copy link
Contributor

shankari commented Nov 9, 2022

For my own edification, I went back to see why I had hardcoded the URL after adding in the functionality to read it from the config. The related commit is 964ed28 in #854
and I don't see any reason why.

So once the testing is done, we can go ahead and commit this.

@sblaisot
Copy link
Contributor Author

sblaisot commented Nov 9, 2022

Hi @shankari

I just added unit test for the 404 redirect

@sblaisot
Copy link
Contributor Author

sblaisot commented Nov 9, 2022

Launching this test on current master:

F
======================================================================
FAIL: test404Redirect (netTests.TestWebserver.TestWebserver)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/opt/openpath/e-mission-server/emission/tests/netTests/TestWebserver.py", line 57, in test404Redirect
    self.assertEqual(response.get_header("Location"), "http://somewhere.else")
AssertionError: 'https://www.nrel.gov/transportation/openpath.html' != 'http://somewhere.else'
- https://www.nrel.gov/transportation/openpath.html
+ http://somewhere.else


----------------------------------------------------------------------
Ran 1 test in 0.786s

Running this test on this PR's source branch:

.
----------------------------------------------------------------------
Ran 1 test in 0.751s

OK

@shankari
Copy link
Contributor

shankari commented Nov 9, 2022

@aGuttman not sure if you have written the unit test for #886 yet, but @sblaisot has already written the first unit test for the API, so you should be able to add yours to this file as well.

@shankari shankari merged commit 4ed9e60 into e-mission:master Nov 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants