File: test_printer_proxy.py

package info (click to toggle)
cloudprint 0.14-12
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 512 kB
  • sloc: python: 1,128; sh: 48; makefile: 16
file content (46 lines) | stat: -rw-r--r-- 842 bytes parent folder | download | duplicates (3)
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,
    )