1
0
mirror of https://github.com/kevin1024/vcrpy.git synced 2025-12-09 17:15:35 +00:00

pep8 fixes

This commit is contained in:
Kevin McCarthy
2013-08-23 19:56:13 -10:00
parent 98603541d6
commit c8299103fb
21 changed files with 177 additions and 76 deletions

View File

@@ -2,24 +2,28 @@ import pytest
import yaml
from vcr.cassette import Cassette
def test_cassette_load(tmpdir):
a_file = tmpdir.join('test_cassette.yml')
a_file.write(yaml.dump([
{'request':'foo', 'response':'bar'}
{'request': 'foo', 'response': 'bar'}
]))
a_cassette = Cassette.load(str(a_file))
assert len(a_cassette) == 1
def test_cassette_not_played():
a = Cassette('test')
assert not a.play_count
def test_cassette_played():
a = Cassette('test')
a.mark_played('foo')
a.mark_played('foo')
assert a.play_count == 2
def test_cassette_play_counter():
a = Cassette('test')
a.mark_played('foo')
@@ -27,28 +31,33 @@ def test_cassette_play_counter():
assert a.play_counts['foo'] == 1
assert a.play_counts['bar'] == 1
def test_cassette_append():
a = Cassette('test')
a.append('foo', 'bar')
assert a.requests == ['foo']
assert a.responses == ['bar']
def test_cassette_len():
a = Cassette('test')
a.append('foo','bar')
a.append('foo2','bar2')
a.append('foo', 'bar')
a.append('foo2', 'bar2')
assert len(a) == 2
def test_cassette_contains():
a = Cassette('test')
a.append('foo','bar')
a.append('foo', 'bar')
assert 'foo' in a
def test_cassette_response_of():
a = Cassette('test')
a.append('foo','bar')
a.append('foo', 'bar')
assert a.response_of('foo') == 'bar'
def test_cassette_get_missing_response():
a = Cassette('test')
with pytest.raises(KeyError):