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

HP-1699 add user agent header #92

Merged
merged 12 commits into from
Sep 26, 2024
Merged

Conversation

george42-ctds
Copy link
Contributor

@george42-ctds george42-ctds commented Sep 23, 2024

JIRA ticket: HP-1699

New Features

Breaking Changes

Bug Fixes

Improvements

  • add User-Agent header to fetch_token and revoke_token

Dependency updates

Deployment changes

Copy link

The style in this PR agrees with black. ✔️

This formatting comment was generated automatically by a script in uc-cdis/wool.

@coveralls
Copy link

coveralls commented Sep 23, 2024

Pull Request Test Coverage Report for Build 11039235829

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 16 unchanged lines in 3 files lost coverage.
  • Overall coverage increased (+1.3%) to 86.122%

Files with Coverage Reduction New Missed Lines %
blueprints/oauth2.py 2 85.48%
resources/oauth2.py 6 87.72%
api.py 8 86.17%
Totals Coverage Status
Change from base Build 10960701398: 1.3%
Covered Lines: 422
Relevant Lines: 490

💛 - Coveralls

Copy link

filepath $$\textcolor{#f14c4c}{\tt{failed}}$$ SUBTOTAL
$$\textcolor{#f14c4c}{\tt{tests/test\_discoverypage.py}}$$ $$\textcolor{#f14c4c}{\tt{1}}$$ $$\textcolor{#f14c4c}{\tt{1}}$$
$$\textcolor{#f14c4c}{\tt{TOTAL}}$$ $$\textcolor{#f14c4c}{\tt{1}}$$ $$\textcolor{#f14c4c}{\tt{1}}$$

Please find the detailed integration test report here

Please find the ci env pod logs here

Copy link

Please find the detailed integration test report here

Please find the ci env pod logs here

Copy link

filepath $$\textcolor{#23d18b}{\tt{passed}}$$ SUBTOTAL
$$\textcolor{#23d18b}{\tt{tests/test\_discoverypage.py}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{TOTAL}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$

Please find the detailed integration test report here

Please find the ci env pod logs here

Copy link

filepath $$\textcolor{#f14c4c}{\tt{failed}}$$ SUBTOTAL
$$\textcolor{#f14c4c}{\tt{tests/test\_discoverypage.py}}$$ $$\textcolor{#f14c4c}{\tt{1}}$$ $$\textcolor{#f14c4c}{\tt{1}}$$
$$\textcolor{#f14c4c}{\tt{TOTAL}}$$ $$\textcolor{#f14c4c}{\tt{1}}$$ $$\textcolor{#f14c4c}{\tt{1}}$$

Please find the detailed integration test report here

Please find the ci env pod logs here

Copy link

filepath $$\textcolor{#23d18b}{\tt{passed}}$$ SUBTOTAL
$$\textcolor{#23d18b}{\tt{tests/test\_discoverypage.py}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{TOTAL}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$

Please find the detailed integration test report here

Please find the ci env pod logs here

Copy link

filepath $$\textcolor{#23d18b}{\tt{passed}}$$ SUBTOTAL
$$\textcolor{#23d18b}{\tt{tests/test\_discoverypage.py}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{TOTAL}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$

Please find the detailed integration test report here

Please find the ci env pod logs here

Copy link
Contributor

@mfshao mfshao left a comment

Choose a reason for hiding this comment

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

looks cool 👍 just some minor comments

client.session.revoke_token(url, token)
app_version = flask.current_app.config.get("APP_VERSION", "0.0.0")
client.session.revoke_token(
url, token, headers={"User-Agent": f"Gen3WTS / {app_version}"}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
url, token, headers={"User-Agent": f"Gen3WTS / {app_version}"}
url, token, headers={"User-Agent": f"Gen3WTS/{app_version}"}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Shoot, that isn't working for me. I'm getting an "Invalid username" message from https://idp.stage.qdr.org/ when I try to log in.

Can you verify if you are able to log in or not? The change is deployed in QA-HEAL.

I had tried removing the spaces in this earlier commit. I wasn't able to log in so I had reverted the change in the next commit.

Copy link
Contributor

Choose a reason for hiding this comment

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

Just tried in QA, I could refresh my QDR creds after logging in via their staging env
Have you regierstered an account at https://stage.qdr.org/ ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it is now working for me! I'm able to log in to stage after being redirected from the qa-heal authorize_url endpoint. I'm not sure why it wasn't working earlier.

I will update the unit tests to remove the spaces in the expected header value.

app_version = flask.current_app.config.get("APP_VERSION", "0.0.0")
tokens = client.fetch_token(
token_url,
headers={"User-Agent": f"Gen3WTS / {app_version}"},
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
headers={"User-Agent": f"Gen3WTS / {app_version}"},
headers={"User-Agent": f"Gen3WTS/{app_version}"},

Copy link

Please find the detailed integration test report here

Please find the ci env pod logs here

Copy link

filepath $$\textcolor{#23d18b}{\tt{passed}}$$ SUBTOTAL
$$\textcolor{#23d18b}{\tt{tests/test\_discoverypage.py}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{TOTAL}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$

Please find the detailed integration test report here

Please find the ci env pod logs here

Copy link
Contributor

@mfshao mfshao left a comment

Choose a reason for hiding this comment

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

👍

@george42-ctds george42-ctds merged commit 6121f2c into master Sep 26, 2024
9 checks passed
@george42-ctds george42-ctds deleted the chore/add-user-agent-header branch September 26, 2024 16:44
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