Hi Aditya,
Since a lot of Postorius code involves calls to Mailman's REST API and
running these tests against a real instance would be painfully slow,
hence ''vcrpy'' cassettess are used. These files contain pre-recorded
HTTP responses. If you write new tests, it's advisable to add a
separate fixture file for each test case. Considering your test, the
fixture file that your test uses contains the following pre-recorded
responses for the following POST requests :
request:
    body: mail_host=example.com
    headers:
      accept-encoding: ['gzip, deflate']
      !!python/unicode content-type: [!!python/unicode
application/x-www-form-urlencoded]
    method: !!python/unicode POST
    uri: http://localhost:9001/3.0/domains

request:
    body: fqdn_listname=foo%40example.com
    headers:
      accept-encoding: ['gzip, deflate']
      !!python/unicode content-type: [!!python/unicode
application/x-www-form-urlencoded]
    method: !!python/unicode POST
    uri: http://localhost:9001/3.0/lists

request:
    body: 
display_name=None&list_id=foo.example.com&pre_approved=True&pre_confirmed=True&pre_verified=True&subscriber=member-1%40example.com
    headers:
      accept-encoding: ['gzip, deflate']
      !!python/unicode content-type: [!!python/unicode
application/x-www-form-urlencoded]
    method: !!python/unicode POST
    uri: http://localhost:9001/3.0/members

request:
    body: 
display_name=None&list_id=foo.example.com&pre_approved=True&pre_confirmed=True&pre_verified=True&subscriber=member-2%40example.com
    headers:
      accept-encoding: ['gzip, deflate']
      !!python/unicode content-type: [!!python/unicode
application/x-www-form-urlencoded]
    method: !!python/unicode POST
    uri: http://localhost:9001/3.0/members

So only these request formats can be used in your test. If you want to
use other request formats then probably you have to record them in the
following fixture file:
src/postorius/tests/fixtures/vcr_cassettes/ListMembersTest.test_search_members_1.yaml

You can also refer to ''vcrpy'' documentation for more information.

Hope this helps.

Regards,
Harshit Bansal.

On 2/24/16, Aditya Divekar <adityadiveka...@gmail.com> wrote:
> Thanks for the help Harshit!
> But I realized that I framed my question improperly. I used the above
> command before too, but it raises an error -
>
> CannotOverwriteExistingCassetteException: No match for the request
> (<Request (POST)
> http://localhost:9001/3.0/members/find?subscriber=%2Aexample.com%2A&list_id=foo.example.com&role=member>)
> was found. Can't overwrite existing cassette
> ('/home/hp/postorius_aditya/src/postorius/tests/fixtures/vcr_cassettes/ListMembersTest.test_search_members_1.yaml')
> in your current record mode ('once').
>
> Is this error because the request is not present in test cases or is it
> some other error?
> Also, if it is a test case problem, can anyone suggest me how to change the
> test case (or where I could read about how to go about it) to make the
> build pass?
>
> Thanks,
> Aditya.
>
_______________________________________________
Mailman-Developers mailing list
Mailman-Developers@python.org
https://mail.python.org/mailman/listinfo/mailman-developers
Mailman FAQ: http://wiki.list.org/x/AgA3
Searchable Archives: 
http://www.mail-archive.com/mailman-developers%40python.org/
Unsubscribe: 
https://mail.python.org/mailman/options/mailman-developers/archive%40jab.org

Security Policy: http://wiki.list.org/x/QIA9

Reply via email to