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

Proposed by Leo Arias
Status: Merged
Merged at revision: 43
Proposed branch: lp:~elopio/cloudspacesclient/upload_file
Merge into: lp:cloudspacesclient
Prerequisite: lp:~elopio/cloudspacesclient/cloudspacer
Diff against target: 53 lines (+35/-1)
1 file modified
src/cloudspacesclient/tests/conformance/test_cloudspaces_api.py (+35/-1)
To merge this branch: bzr merge lp:~elopio/cloudspacesclient/upload_file
Reviewer Review Type Date Requested Status
Richard Huddie (community) Approve
Review via email: mp+197151@code.launchpad.net

Commit message

Added the test to upload a file.

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

Removed the conflict file.

35. By Leo Arias

Merged with trunk.

36. By Leo Arias

Merged with trunk.

37. By Leo Arias

Updated the vars.

38. By Leo Arias

Updated the size.

39. By Leo Arias

The hash is not none.

40. By Leo Arias

Fixed the method call.

Revision history for this message
Richard Huddie (rhuddie) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/cloudspacesclient/tests/conformance/test_cloudspaces_api.py'
2--- src/cloudspacesclient/tests/conformance/test_cloudspaces_api.py 2013-12-06 15:26:59 +0000
3+++ src/cloudspacesclient/tests/conformance/test_cloudspaces_api.py 2013-12-06 16:54:26 +0000
4@@ -239,7 +239,7 @@
5 self._assert_json_object_values(expected, metadata)
6
7 def test_create_new_file(self):
8- test_file_name = 'test.txt'
9+ test_file_name = 'new_test_file.txt'
10 test_file_mimetype = 'text/plain'
11
12 metadata = self.cloudspaces_api_client.make_file(
13@@ -266,6 +266,40 @@
14 # TODO check the user_id. --elopio - 2013-11-27
15 # TODO Check the volume_id field. --elopio - 2013-11-27
16
17+ def test_upload_file(self):
18+ test_file_name = 'file_to_upload.txt'
19+ test_file_mimetype = 'text/plain'
20+
21+ new_file_metadata = self.cloudspaces_api_client.make_file(
22+ self.root_node_id, test_file_name)
23+ file_node_id = new_file_metadata.get('node_id')
24+
25+ file_upload_metadata = self.cloudspaces_api_client.put_file(
26+ file_node_id, 'test contents')
27+
28+ validictory.validate(
29+ file_upload_metadata, schemas.GET_FILE_METADATA_RESPONSE_SCHEMA)
30+
31+ root_path = self.test_server.get_root_path()
32+ expected = dict(
33+ filename=test_file_name, is_deleted=False, is_folder=False,
34+ mimetype=test_file_mimetype, parent_node_id=self.root_node_id,
35+ path=root_path, size=13)
36+ self._assert_json_object_values(expected, file_upload_metadata)
37+
38+ # Assert that the file has just been modified.
39+ self.assert_datetime_limits(
40+ parser.parse(file_upload_metadata.get('server_modified')),
41+ self.start_datetime, self._get_now_datetime())
42+ # TODO update the spec because it says checksum instead of hash.
43+ # --elopio - 2013-11-27
44+ # TODO The spec doesn't include it in the filename in the examples.
45+ # --elopio - 2013-11-25
46+ # TODO check the user_id. --elopio - 2013-11-27
47+ # TODO Check the volume_id field. --elopio - 2013-11-27
48+ # TODO Check the hash, that depends on the server implementation.
49+ # --elopio - 2013-12-06
50+
51 def test_download_empty_file(self):
52 test_file_name = 'test_file_to_download.txt'
53 create_metadata = self.cloudspaces_api_client.make_file(

Subscribers

People subscribed via source and target branches

to all changes: