add vms fixture that gets recorded using vcrpy

Should help prevent creating duplicate vcrpy yaml's in
onedns/tests/fixtures for the same 'get all vms' request in multiple
tests.
master
Justin Riley 2016-08-12 11:24:52 -04:00
parent 6892508b9e
commit 56f6998753
2 changed files with 8 additions and 3 deletions

View File

@ -1,6 +1,7 @@
import pytest
from onedns import resolver
from onedns.tests import vcr
from onedns.clients import one
@ -23,3 +24,9 @@ def oneclient(request):
NOTE: All fixtures must be function scope to work with VCRPY cassettes
"""
return one.OneClient()
@pytest.fixture(scope="function")
@vcr.use_cassette()
def vms(oneclient):
return oneclient.vms()

View File

@ -6,9 +6,7 @@ import oca
from oca import vm
@vcr.use_cassette()
def test_get_vms(oneclient):
vms = oneclient.vms()
def test_get_vms(vms):
assert isinstance(vms, vm.VirtualMachinePool)
assert len(vms) > 0