Revision 2560c061 snf-pithos-app/pithos/api/test/containers.py

b/snf-pithos-app/pithos/api/test/containers.py
943 943

  
944 944
        r = self.upload_object('c1', length=1)
945 945

  
946
    def test_upload_blocks(self):
947
        cname = self.create_container()[0]
948

  
949
        url = join_urls(self.pithos_path, self.user, cname)
950
        r = self.post(url, data=get_random_data())
951
        self.assertEqual(r.status_code, 202)
952

  
953
        url = join_urls(self.pithos_path, 'chuck', cname)
954
        r = self.post(url, data=get_random_data())
955
        self.assertEqual(r.status_code, 403)
956

  
957
        # share object for read only
958
        oname = self.upload_object(cname)[0]
959
        url = join_urls(self.pithos_path, self.user, cname, oname)
960
        self.post(url, content_type='', HTTP_CONTENT_RANGE='bytes */*',
961
                  HTTP_X_OBJECT_SHARING='read=*')
962
        url = join_urls(self.pithos_path, 'chuck', cname)
963
        r = self.post(url, data=get_random_data())
964
        self.assertEqual(r.status_code, 403)
965

  
966
        # share object for write only
967
        oname = self.upload_object(cname)[0]
968
        url = join_urls(self.pithos_path, self.user, cname, oname)
969
        self.post(url, content_type='', HTTP_CONTENT_RANGE='bytes */*',
970
                  HTTP_X_OBJECT_SHARING='write=*')
971
        url = join_urls(self.pithos_path, 'chuck', cname)
972
        r = self.post(url, data=get_random_data())
973
        self.assertEqual(r.status_code, 403)
974

  
946 975

  
947 976
class ContainerDelete(PithosAPITest):
948 977
    def setUp(self):

Also available in: Unified diff