machalekj/rt — pull request #5 by sperrygrove (2013-09-12 11:21:40+00:00)
Title: Attachment list

Hello again.

I'm working on adding some functionality that I need to your RT wrapper. This is the second of a few patches that I'm aiming to submit.

While using the get_attachment() method, I found that the utf-8 decoding of the response in __request() is failing when delivering a binary content payload. The headers and content should perhaps be split and dealt with separately. I followed a different route according to my needs and wrote a method to retrieve the full list of attachments in order to get the content type since I need to send attachments to the browser. I then use get_attachment_content() to deliver the content. This patch addresses that.

Incidentally, I couldn't get your test case to pass. The ticket linking is failing:

======================================================================
FAIL: test_ticket_operations (__main__.RtTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test_rt.py", line 131, in test_ticket_operations
self.assertTrue(links1['DependsOn'][0].endswith('ticket/' + str(ticket2_id)), 'Unexpected value of link DependsOn.')
AssertionError: Unexpected value of link DependsOn.
======================================================================
In the RT3.8 stable instance, new tickets appear to be linked to ticket 1:
{u'id': [u'ticket/40/links'], u'DependsOn': [u'fsck.com-rt://example.com/ticket/1']}

Regards
Stewart Perrygrove