1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
import mock
import pytest
from cloudprint.cloudprint import PrinterProxy
@pytest.fixture
def cpp():
return mock.Mock(name='cpp')
@pytest.fixture
def printer_proxy(cpp):
return PrinterProxy(
cpp=cpp,
printer_id='1',
name='printer 1',
)
def test_get_jobs(cpp, printer_proxy):
printer_proxy.get_jobs()
cpp.get_jobs.assert_called_with(printer_proxy.id)
def test_update(cpp, printer_proxy):
printer_proxy.update(
description='printer_description',
ppd='printer_ppd',
)
cpp.update_printer.assert_called_with(
printer_proxy.id,
printer_proxy.name,
'printer_description',
'printer_ppd',
)
def test_delete(cpp, printer_proxy):
printer_proxy.delete()
cpp.delete_printer.assert_called_with(
printer_proxy.id,
)
|