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

[WIP] Cassettes mutation #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

[WIP] Cassettes mutation #14

wants to merge 1 commit into from

Conversation

Stranger6667
Copy link
Collaborator

@Stranger6667 Stranger6667 commented Aug 9, 2019

TODO:

  • Register mutation marker
  • Docstrings
  • Run mutation tests on the repo & write all the missing cases
  • Coverage 100%
  • Support gzipped cassettes body
  • JSON mutations for different types - arrays, bool, etc.
  • mutate body to a different content type
  • Error handling for not-supported mutations
  • Fix & update docs
  • Move cassettes update to master to have smaller change surface in this PR

Next steps (after this PR):

  • Headers mutations
  • Mutations for XML

@Stranger6667 Stranger6667 self-assigned this Aug 9, 2019
@Stranger6667 Stranger6667 force-pushed the dd/mutations branch 4 times, most recently from 0e6a77d to f370d1f Compare August 12, 2019 05:38
@codecov-io
Copy link

codecov-io commented Aug 12, 2019

Codecov Report

Merging #14 into master will decrease coverage by 2.18%.
The diff coverage is 94.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #14      +/-   ##
==========================================
- Coverage     100%   97.81%   -2.19%     
==========================================
  Files           4        8       +4     
  Lines         175      274      +99     
  Branches       21       36      +15     
==========================================
+ Hits          175      268      +93     
- Misses          0        5       +5     
- Partials        0        1       +1
Impacted Files Coverage Δ
src/pytest_recording/_compat.py 100% <100%> (ø)
src/pytest_recording/_vcr.py 100% <100%> (ø) ⬆️
src/pytest_recording/mutations/__init__.py 100% <100%> (ø)
src/pytest_recording/mutations/core.py 100% <100%> (ø)
src/pytest_recording/mutations/mutagens.py 84% <84%> (ø)
src/pytest_recording/plugin.py 97.61% <90.9%> (-2.39%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e471e1e...55ab7f7. Read the comment docs.

data = json.loads(cassette["body"]["string"])
# it could be a list or other json type
# take out random key
key = random.choice(list(data.keys()))

Choose a reason for hiding this comment

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

What if body format is not JSON (e.g. XML)?

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.

None yet

3 participants