diff options
author | kballou <kballou@devnulllabs.io> | 2015-04-10 17:02:26 -0600 |
---|---|---|
committer | kballou <kballou@devnulllabs.io> | 2015-04-10 18:03:44 -0600 |
commit | 00af7173095e132bebe6417cdbbfc6dd2e4cd156 (patch) | |
tree | d5d744a1e780f9f7dff5fcc65f1d00295643de59 | |
parent | cf6a40d8eb658f2b13cae8ed46f4a523f170f1cb (diff) | |
download | pylibchorus-00af7173095e132bebe6417cdbbfc6dd2e4cd156.tar.gz pylibchorus-00af7173095e132bebe6417cdbbfc6dd2e4cd156.tar.xz |
Add _delete_workfile_
-rw-r--r-- | pylibchorus/chorus_client.py | 15 | ||||
-rw-r--r-- | pylibchorus/tests/chorus_client_tests.py | 13 |
2 files changed, 28 insertions, 0 deletions
diff --git a/pylibchorus/chorus_client.py b/pylibchorus/chorus_client.py index ed37be2..ba40f7f 100644 --- a/pylibchorus/chorus_client.py +++ b/pylibchorus/chorus_client.py @@ -129,3 +129,18 @@ def _update_workfile_version_(userid, workfile_id, workfile, sid, cookies): 'url': '/workfiles/%s/versions' % workfile_id, 'method': 'POST', } + +def _delete_workfile_(workfile_id, sid, cookies): + '''Create request data to delete a workfile''' + return { + 'data': None, + 'params': { + 'session_id': sid, + }, + 'headers': { + 'content-type': CONTENT_TYPE, + }, + 'cookies': cookies, + 'url': '/workfiles/%s' % workfile_id, + 'method': 'DELETE', + } diff --git a/pylibchorus/tests/chorus_client_tests.py b/pylibchorus/tests/chorus_client_tests.py index 0829f50..da1f81f 100644 --- a/pylibchorus/tests/chorus_client_tests.py +++ b/pylibchorus/tests/chorus_client_tests.py @@ -7,6 +7,7 @@ from pylibchorus.chorus_client import _logout_ from pylibchorus.chorus_client import _check_login_ from pylibchorus.chorus_client import _create_workfile_ from pylibchorus.chorus_client import _update_workfile_version_ +from pylibchorus.chorus_client import _delete_workfile_ import unittest LOG = logging.getLogger(__name__) @@ -157,3 +158,15 @@ class ChorusSessionTests(unittest.TestCase): self.assertEquals(data['content'], workfile) self.assertEquals('/workfiles/1/versions', actual['url']) self.assertEquals('POST', actual['method']) + + def test_delete_workfile_returs_rquest_data(self): + '''Test _delete_workfile_ returns correct request data''' + workfile_id = 1 + sid = 'foobar' + cookies = {'session_id': sid} + actual = _delete_workfile_(workfile_id, sid, cookies) + check_request_structure(self, actual) + check_params(self, actual['params'], sid) + self.assertIsNone(actual['data']) + self.assertEquals('/workfiles/1', actual['url']) + self.assertEquals('DELETE', actual['method']) |