Commit 307e3826 authored by Sofia Papagiannaki's avatar Sofia Papagiannaki

pithos: Extend/fix tests

parent 38629d20
......@@ -118,7 +118,8 @@ class ContainerHead(PithosAPITest):
self.assertTrue('X-Container-Meta-Quality' in container_info)
self.assertTrue('X-Container-Meta-Foo' in container_info)
self.assertTrue('X-Container-Object-Count' in container_info)
self.assertTrue(int(container_info['X-Container-Object-Count']) > len(objects))
self.assertTrue(int(container_info['X-Container-Object-Count']) >
len(objects))
self.assertTrue('X-Container-Bytes-Used' in container_info)
t = datetime.datetime.strptime(container_info['Last-Modified'],
......@@ -134,13 +135,15 @@ class ContainerHead(PithosAPITest):
container_info['X-Container-Until-Timestamp'], DATE_FORMATS[2])
self.assertTrue(int(_time.mktime(t1.timetuple())) <= until)
self.assertTrue('X-Container-Object-Count' in container_info)
self.assertEqual(int(container_info['X-Container-Object-Count']), len(objects))
self.assertEqual(int(container_info['X-Container-Object-Count']),
len(objects))
self.assertTrue('X-Container-Bytes-Used' in container_info)
self.assertEqual(int(container_info['X-Container-Bytes-Used']),
sum([len(data) for data in objects.values()]))
self.assertTrue('X-Container-Object-Meta' in container_info)
self.assertEqual(container_info['X-Container-Object-Meta'],
','.join(sorted(metalist)))
self.assertEqual(
sorted(container_info['X-Container-Object-Meta'].split(',')),
sorted(metalist))
class ContainerGet(PithosAPITest):
......
......@@ -49,13 +49,19 @@ class ListSharing(PithosAPITest):
self.create_folder(cname, 'f1/f2', user=user)
self.upload_object(cname, 'f1/f2/obj', user=user)
# share /c0/f1 path
# share /c0/f1 path for read
url = join_urls(self.pithos_path, user, 'c0', 'f1')
r = self.post(url, user=user, content_type='',
HTTP_CONTENT_RANGE='bytes */*',
HTTP_X_OBJECT_SHARING='read=*')
self.assertEqual(r.status_code, 202)
r = self.get(url)
# share /c0/f1/f2 path for write
url = join_urls(self.pithos_path, user, 'c0', 'f1/f2')
r = self.post(url, user=user, content_type='',
HTTP_CONTENT_RANGE='bytes */*',
HTTP_X_OBJECT_SHARING='write=*')
self.assertEqual(r.status_code, 202)
def test_list_share_with_me(self):
self._build_structure('alice')
......
......@@ -343,3 +343,21 @@ class TestPermissions(PithosAPITest):
self.assertEqual(r.status_code, 403)
r = self.delete(url, user='chuck')
self.assertEqual(r.status_code, 403)
def test_multiple_inheritance(self):
cname = self.container
folder = self.create_folder(cname, HTTP_X_OBJECT_SHARING='write=*')[0]
subfolder = self.create_folder(cname, '%s/%s' % (folder,
get_random_name()))[0]
self.upload_object(cname, '%s/%s' % (subfolder, get_random_name()))
self._assert_read(subfolder, self.users)
self._assert_write(subfolder, self.users)
# share object for read only
url = join_urls(self.pithos_path, self.user, cname, subfolder)
self.post(url, content_type='', HTTP_CONTENT_RANGE='bytes */*',
HTTP_X_OBJECT_SHARING='read=*')
self._assert_read(subfolder, self.users)
self._assert_write(subfolder, [])
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment