pdjohntony / vcrpy-cassette-mgr

Easily open or delete vcrpy cassettes within your tests.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Multiple cassettes found when tests have same base name

pdjohntony opened this issue · comments

This issue is a result of fixing #1 in v1.1.2.

Now that cassette searching can match multiple files for a single test, if two tests share the same base name, the wrong cassette can be matched for a test.

Here is the new cassette matching code:

const matchingFiles = files.filter(file => file.startsWith(`${vcrDecorator.vcrTestName}`) && file.endsWith('.yaml'));

Here are some example test names:

test_msteams_service_emergency_address_create
test_msteams_service_emergency_address_create_without_latlon

These overlapping names will cause test_msteams_service_emergency_address_create to also match the cassettes for test_msteams_service_emergency_address_create_without_latlon.

This is also causing an issue during the deleteCassettesCurrentFile command. Where the same cassettes can become duplicated in the currentFileCassettesArray and will cause subsequent deletion failures.

Fixed in 1.1.3