Closed facetoe closed 6 years ago
Does this fail when recording the cassette, when playing it, or in both cases?
Yep, it fails in both cases.
I assume this is from https://github.com/facetoe/zenpy could you share the code entirely? I.e. push to a wip branch etc.
Sure, no worries, I've pushed to this branch: https://github.com/facetoe/zenpy/tree/betamax_test
From the failing tests in on Travis, it seems betamax is trying to handle the correct request:
A request was made to https://d3v-zenpydev.zendesk.com/api/v2/tickets.json?include=users%2Cgroups%2Corganizations%2Clast_audits%2Cmetric_sets%2Cdates%2Csharing_agreements%2Ccomment_count%2Cincident_counts%2Cticket_forms%2Cmetric_events%2Cslas&&page=2&per_page=100 that could not be found in TestTicketGeneratorSlice.test_ticket_slice_cross_page_size_boundry.
I'm pretty sure this is a bug in my code somehow (surprise surprise!) and not Betamax. When it executes under test it generates the parameter page=1
, yet when it executes in my IDE or on Travis it generates page=2
... Going to need to do some digging.
Thanks for your help!
Aha! Looks like nosetests
executes python2
, and I can recreate that same bug by running my code under python2
, I'm not going mad after all! So nothing to do with Betamax after all :)
Glad you figured it out @facetoe! For what it's worth, I think you might also want to match on the query string (you're currently matching on the path and method) but you know your code better so feel free to ignore that suggestion :)
Also, I see some recorded authorization headers in the cassettes, not sure if real or fake.
@sigmavirus24, yes good point, I should be matching on query also. Thanks!
@hroncok thanks for the heads up, I'll fix that.
Hi, I'm having an issue with a failing test and I'm not sure how to debug it further. When I execute the following code in my IDE:
These requests are generated:
Note the
page=2
parameter in the last request.These requests result in the expected output:
[Ticket(id=100), Ticket(id=101)]
However, when I execute the following test using Betamax:
It fails with the error:
AssertionError: expected Ticket id: 101, found: Ticket(id=1), values: [Ticket(id=100), Ticket(id=1)]
Looking at the requests saved by Betamax, I notice something funny:
Note the
page=1
parameter in the last request. I'm confused as to why the generated requests differ?The
page
andper_page
parameters are passed torequests
via theparams
dict, if that helps at all.Any idea what's going on here? My Betamax instance is configured as follows:
Version information:
Any help would be greatly appreciated!