Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions pyipptool/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,24 +367,18 @@ def create_job_subscription(self,
"""
Create a per-job subscription object.

Create-Job-Subscription ???
http://www.cups.org/documentation.php/spec-ipp.html

OR

Create-Job-Subscriptions ???
Create-Job-Subscriptions
https://tools.ietf.org/html/rfc3995#section-11.1.1

A ticket is open for the current bug in cups
https://www.cups.org/str.php?L4389
"""
raise NotImplementedError
kw = {'operation_attributes':
{'printer_uri': printer_uri,
'requesting_user_name': requesting_user_name,
'notify_job_id': notify_job_id,
'job_id': job_id,
'job_uri': job_uri},
'notify_job_id': notify_job_id,
'notify_recipient_uri': notify_recipient_uri,
'notify_pull_method': notify_pull_method,
'notify_events': notify_events,
Expand Down
2 changes: 2 additions & 0 deletions pyipptool/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,8 @@ class CreateSubscriptionSchema(BaseIPPSchema):
operation_attributes = SubscriptionOperationAttributes(
widget=IPPTupleWidget())
object_attributes_tag = 'subscription-attributes-tag'
notify_job_id = colander.SchemaNode(colander.Integer(),
widget=IPPAttributeWidget())
notify_recipient_uri = colander.SchemaNode(Uri(),
widget=IPPAttributeWidget())
notify_pull_method = colander.SchemaNode(Keyword(),
Expand Down
57 changes: 28 additions & 29 deletions tests/test_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,14 @@ def test_create_printer_subscription_form():
assert 'ATTR integer notify-time-interval 1' in request


@pytest.mark.xfail
def test_create_job_subscription_form_for_pull_delivery_method():
from pyipptool.forms import create_job_subscription_form
request = create_job_subscription_form.render(
{'operation_attributes':
{'printer_uri': 'https://localhost:631/printer/p',
'requesting_user_name': 'admin',
'notify_job_id': 12},
'requesting_user_name': 'admin'},
'notify_recipient_uri': 'rss://',
'notify_job_id': 12,
'notify_events': ('job-completed', 'job-created', 'job-progress'),
'notify_attributes': 'notify-subscriber-user-name',
'notify_charset': 'utf-8',
Expand Down Expand Up @@ -503,19 +502,19 @@ def test_create_job_form():
'job_impressions': 2048,
'job_media_sheets': 2},
'sub_operation_attributes':
{'job_priority': 1,
'job_hold_until': 'indefinite',
'job_sheets': 'standard',
'multiple_document_handling': 'single-document',
'copies': 2,
'finishings': 'punch',
'page_ranges': '1-6',
'sides': 'two-sided-short-edge',
'number_up': 4,
'orientation_requested': 'reverse-landscape',
'media': 'iso-a4-white',
'printer_resolution': '600dpi',
'print_quality': 5},
{'job_priority': 1,
'job_hold_until': 'indefinite',
'job_sheets': 'standard',
'multiple_document_handling': 'single-document',
'copies': 2,
'finishings': 'punch',
'page_ranges': '1-6',
'sides': 'two-sided-short-edge',
'number_up': 4,
'orientation_requested': 'reverse-landscape',
'media': 'iso-a4-white',
'printer_resolution': '600dpi',
'print_quality': 5},
'auth_info': 'michael',
'job_billing': 'no-idea',
'job_sheets': 'none',
Expand Down Expand Up @@ -569,19 +568,19 @@ def test_print_job_form():
'job_impressions': 2048,
'job_media_sheets': 2},
'sub_operation_attributes':
{'job_priority': 1,
'job_hold_until': 'indefinite',
'job_sheets': 'standard',
'multiple_document_handling': 'single-document',
'copies': 2,
'finishings': 'punch',
'page_ranges': '1-6',
'sides': 'two-sided-short-edge',
'number_up': 4,
'orientation_requested': 'reverse-landscape',
'media': 'iso-a4-white',
'printer_resolution': '600dpi',
'print_quality': 5},
{'job_priority': 1,
'job_hold_until': 'indefinite',
'job_sheets': 'standard',
'multiple_document_handling': 'single-document',
'copies': 2,
'finishings': 'punch',
'page_ranges': '1-6',
'sides': 'two-sided-short-edge',
'number_up': 4,
'orientation_requested': 'reverse-landscape',
'media': 'iso-a4-white',
'printer_resolution': '600dpi',
'print_quality': 5},
'auth_info': 'michael',
'job_billing': 'no-idea',
'job_sheets': 'none',
Expand Down
21 changes: 11 additions & 10 deletions tests/test_highlevel.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import pyipptool


@pytest.mark.xfail
@mock.patch.object(pyipptool.wrapper, '_call_ipptool')
def test_ipptool_create_job_subscription_pull_delivery_method(_call_ipptool):
from pyipptool import create_job_subscription
Expand All @@ -27,15 +26,17 @@ def test_ipptool_create_job_subscription_pull_delivery_method(_call_ipptool):
notify_natural_language='de',
notify_time_interval=1)
request = _call_ipptool._mock_mock_calls[0][1][0]
assert 'printer-uri https://localhost:631/printer/p' in request
assert 'requesting-user-name admin' in request
assert 'notify-job-id 108' in request
assert 'notify-recipient-uri rss://' in request
assert 'notify-events job-completed,job-created,job-progress' in request
assert 'notify-attributes notify-subscriber-user-name' in request
assert 'notify-charset utf-8' in request
assert 'notify-natural-language de' in request
assert 'notify-time-interval 1' in request
assert 'ATTR uri printer-uri https://localhost:631/printer/p' in request
assert 'ATTR name requesting-user-name admin' in request
assert 'ATTR integer notify-job-id 108' in request
assert 'ATTR uri notify-recipient-uri rss://' in request
assert ('ATTR keyword notify-events job-completed,job-created,job-progress'
in request)
assert ('ATTR keyword notify-attributes notify-subscriber-user-name'
in request)
assert 'ATTR charset notify-charset utf-8' in request
assert 'ATTR language notify-natural-language de' in request
assert 'ATTR integer notify-time-interval 1' in request


@mock.patch.object(pyipptool.wrapper, '_call_ipptool')
Expand Down