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

Freeze httpoison jason issue #45 #48

Merged

Conversation

cheerfulstoic
Copy link
Contributor

Hey! Following up from here. Sorry for the delay 😄

This PR is mainly about the version changes in mix.exs, but I needed to fix some things in the tests to get the tests running on my machine, so those changes are here too.

I didn't do anything with dependabot because I suspect that if you use >= instead of ~> then dependably won't ever suggest changes, or if it does it will only suggest changes to your mix.lock file, which doesn't change your package dependencies for users of the library.

What I did:

It looks like you’re just using the post/3 and get/2 functions from httpoison. The earliest docs I could find for httpoison go back to 0.6.1:

https://hexdocs.pm/httpoison/0.6.1/index.html

The order of the arguments seems to be the same, and when I force the version to be 0.6.1 in mix.exs the tests pass. Though it would be worth testing 0.6.1 without the mock because the mock gives a static interface. It’s maybe worth using a library like mox which will complain when your mock differs from the actual implementation’s behavior (probably for later 😊)

The jason library was easier because while it’s used three times, two of those times are in the HTTPoison mock. The lib usage was just a Jason.decode/1 which isn’t likely to every break. I tested freezing jason in place at version 1.0.0 and it worked fine, so I made that the lowest allowed version.

Use a keyword list instead of a map to preserve order.  Also use interpolation in test expectations for readability
Usage is just one case of post/3 and one case of get/2, so it's unlikely that httpoison's interface will change for this usage
@nelsonic nelsonic added enhancement New feature or enhancement of existing functionality awaiting-review An issue or pull request that needs to be reviewed T25m Time Estimate 25 Minutes technical A technical issue that requires understanding of the code, infrastructure or dependencies elixir Pull requests that update Elixir code labels Feb 6, 2024
@nelsonic nelsonic requested a review from LuchoTurtle February 6, 2024 23:20
Copy link

codecov bot commented Feb 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (b74360f) 100.00% compared to head (1d372f8) 100.00%.
Report is 2 commits behind head on main.

❗ Current head 1d372f8 differs from pull request most recent head c8718a0. Consider uploading reports for the commit c8718a0 to get more accurate results

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #48   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            2         2           
  Lines           34        34           
=========================================
  Hits            34        34           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@LuchoTurtle
Copy link
Member

Thank you so much for the PR @cheerfulstoic ❤️ .

We're merging this and publishing the app ASAP so you won't have any more problems.

Regarding mocking, I agree that we could go with mox for this. We've just added that mock to make testing easier for people who use the package, as well. If they just want quick testing, they can simply turn httpoison_mock:true in their text.exs config files are and are ready to go! (hence why we have the following line in the source code)

@httpoison (Application.compile_env(:elixir_auth_microsoft, :httpoison_mock) && ElixirAuthMicrosoft.HTTPoisonMock) || HTTPoison

Regardless, I've updated the demo and added a note about this in the README.

Again, thank you so much for the PR, it's really appreciated :D

@LuchoTurtle LuchoTurtle merged commit 8a934b1 into dwyl:main Feb 8, 2024
1 check passed
@nelsonic
Copy link
Member

nelsonic commented Feb 8, 2024

nice

@cheerfulstoic
Copy link
Contributor Author

Awesome, thank you! I've updated and I can use the latest HTTPoison now 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-review An issue or pull request that needs to be reviewed elixir Pull requests that update Elixir code enhancement New feature or enhancement of existing functionality T25m Time Estimate 25 Minutes technical A technical issue that requires understanding of the code, infrastructure or dependencies
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants