Merge lp:~elopio/cloudspacesclient/delete_file into lp:cloudspacesclient

Proposed by Leo Arias
Status: Merged
Merged at revision: 33
Proposed branch: lp:~elopio/cloudspacesclient/delete_file
Merge into: lp:cloudspacesclient
Diff against target: 63 lines (+37/-3)
2 files modified
src/cloudspacesclient/config/cloudspaces.conf (+7/-3)
src/cloudspacesclient/tests/conformance/test_cloudspaces_api.py (+30/-0)
To merge this branch: bzr merge lp:~elopio/cloudspacesclient/delete_file
Reviewer Review Type Date Requested Status
Richard Huddie (community) Approve
Review via email: mp+197749@code.launchpad.net

Commit message

Added the test to delete a file.

To post a comment you must log in.
34. By Leo Arias

Fixed pep8.

Revision history for this message
Richard Huddie (rhuddie) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/cloudspacesclient/config/cloudspaces.conf'
2--- src/cloudspacesclient/config/cloudspaces.conf 2013-12-04 14:55:38 +0000
3+++ src/cloudspacesclient/config/cloudspaces.conf 2013-12-04 16:26:34 +0000
4@@ -1,7 +1,7 @@
5 [cloudspaces]
6-cloudspaces_server_url = http://u1.local:8003
7-#cloudspaces_server_url = http://u1-precise.local:8003
8-cloudspaces_server_adapter = cloudspacesclient.ubuntuone.UbuntuOneServer
9+#cloudspaces_server_url = http://u1.local:8003
10+cloudspaces_server_url = http://u1-precise:38096
11+cloudspaces_server_adapter = cloudspacesclient.ubuntuone.UbuntuOneServerWithExistingUser
12
13 [ubuntuone]
14 sso_server_url = http://sso.local:8001
15@@ -10,3 +10,7 @@
16 ubuntuone_server_url = http://u1.local:8003
17 #ubuntuone_server_url = http://u1-precise.local:8003
18 #ubuntuone_server_url = https://staging.one.ubuntu.com
19+consumer_key = ubuntuone
20+consumer_secret = hammertime
21+token_key = jqRRrGlhjxscp8tf45L0
22+token_secret = 849ccNm3VKcgvxm49CmnvV6t0Gs4cSrgzJscrglcjFhFd5TKt293jJTHkSMRhbwFZSp7vnR077cx4cQ9
23
24=== modified file 'src/cloudspacesclient/tests/conformance/test_cloudspaces_api.py'
25--- src/cloudspacesclient/tests/conformance/test_cloudspaces_api.py 2013-12-04 14:55:38 +0000
26+++ src/cloudspacesclient/tests/conformance/test_cloudspaces_api.py 2013-12-04 16:26:34 +0000
27@@ -285,6 +285,36 @@
28 # TODO check the user_id. --elopio - 2013-11-27
29 # TODO Check the volume_id field. --elopio - 2013-11-27
30
31+ def test_delete_file(self):
32+ root_node_id, root_path = self._get_root_info()
33+ test_file_name = 'test_file_to_delete.txt'
34+ test_file_mimetype = 'text/plain'
35+
36+ create_metadata = self.cloudspaces_api_client.make_file(
37+ root_node_id, test_file_name)
38+ file_node_id = create_metadata.get('node_id')
39+ delete_metadata = self.cloudspaces_api_client.delete(file_node_id)
40+
41+ # We don't check the version of the file after it is deleted, as it
42+ # depends on the provider's implementation.
43+ expected = dict(
44+ hash=None, filename=test_file_name, is_deleted=True,
45+ is_folder=False, mimetype=test_file_mimetype,
46+ parent_node_id=root_node_id, path=root_path, size=0)
47+ self._assert_json_object_values(expected, delete_metadata)
48+
49+ self._assert_content_path(
50+ file_node_id, delete_metadata.get('content_path'))
51+ self._assert_resource_path(
52+ file_node_id, delete_metadata.get('resource_path'))
53+ # Assert that the file has just been modified.
54+ self._assert_datetime_limits(
55+ parser.parse(delete_metadata.get('server_modified')),
56+ self.start_datetime,
57+ self._get_now_datetime())
58+ # TODO check the user_id. --elopio - 2013-11-27
59+ # TODO Check the volume_id field. --elopio - 2013-11-27
60+
61 def test_delete_folder_in_root(self):
62 # get the root node id and root folder name
63 root_node_id, root_name = self._get_root_info()

Subscribers

People subscribed via source and target branches

to all changes: