You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In its current form, the test suite requires some state to function. Patient IDs for instance live as strings in tests. This makes generating new VCR cassettes difficult. In the unfortunate event of a breaking API change, fixing this library would represent a significant amount of test refactoring.
The key indicator here is one should be able to delete all cassettes, run the entire test suite, and all new cassettes are regenerated without errors.
I propose that several fixtures be introduced to either get or create the necessary state on a Welkin test instance. For example, a Patient fixture could be made that records its own cassette:
conftest.py
# Note: This is not necessarily functional code, just illustrating an idea.@pytest.fixturedefpatient(client, vcr):
create_kwargs= {
"firstName": "Foo",
"lastName": "Bar",
"externalId": "welkin-health-test",
}
withvcr.use_cassette("patient_id"):
forpatientinclient.Patients().get(paginate=True, size=2000):
ifpatient.externalId==create_kwargs["externalId"]:
returnpatientreturnclient.Patient(**create_kwargs).create()
@pytest.fixturedefpatient_id(patient):
returnpatient.id
test_patients.py
# Refactored to use the new "patient_id" fixture@pytest.mark.vcrdeftest_patient_read(client, patient_id, vcr_cassette):
patient=client.Patient(id=patient_id).get()
assertisinstance(patient, Patient)
assertpatient.id==patient_idassertlen(vcr_cassette) ==1
The text was updated successfully, but these errors were encountered:
In its current form, the test suite requires some state to function. Patient IDs for instance live as strings in tests. This makes generating new VCR cassettes difficult. In the unfortunate event of a breaking API change, fixing this library would represent a significant amount of test refactoring.
The key indicator here is one should be able to delete all cassettes, run the entire test suite, and all new cassettes are regenerated without errors.
I propose that several fixtures be introduced to either get or create the necessary state on a Welkin test instance. For example, a Patient fixture could be made that records its own cassette:
conftest.py
test_patients.py
The text was updated successfully, but these errors were encountered: