use vcrpy for oneclient tests
Will commit cassettes later once the tests have been executed on a test VM and the test authorization token has been stripped.master
parent
eff941dbf8
commit
679f3a0369
|
@ -0,0 +1,11 @@
|
|||
import os
|
||||
|
||||
from vcr import VCR
|
||||
|
||||
vcr = VCR(
|
||||
serializer='yaml',
|
||||
cassette_library_dir=os.path.join(
|
||||
os.path.dirname(os.path.realpath(__file__)), 'fixtures/oneclient'
|
||||
),
|
||||
record_mode='once',
|
||||
)
|
|
@ -17,6 +17,9 @@ def dns(request):
|
|||
return dns
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
@pytest.fixture(scope="function")
|
||||
def oneclient(request):
|
||||
"""
|
||||
NOTE: All fixtures must be function scope to work with VCRPY cassettes
|
||||
"""
|
||||
return one.OneClient()
|
||||
|
|
|
@ -1,15 +1,19 @@
|
|||
from onedns.tests import vcr
|
||||
|
||||
import pytest
|
||||
|
||||
import oca
|
||||
from oca import vm
|
||||
|
||||
|
||||
@vcr.use_cassette()
|
||||
def test_get_vms(oneclient):
|
||||
vms = oneclient.vms()
|
||||
assert isinstance(vms, vm.VirtualMachinePool)
|
||||
assert len(vms) > 0
|
||||
|
||||
|
||||
@vcr.use_cassette()
|
||||
def test_get_vm_by_id(oneclient):
|
||||
with pytest.raises(TypeError):
|
||||
oneclient.get_vm_by_id('asdf')
|
||||
|
|
Loading…
Reference in New Issue