Revision e7f5ebd0

b/snf-tools/synnefo_tools/burnin/pithos_tests.py
773 773
        """MISSING: test transfer-encoding?"""
774 774

  
775 775
    def test_060_object_copy(self):
776
        """Test object COPY"""
776 777
        pithos = self.clients.pithos
777 778
        obj, trg = 'source.file2copy', 'copied.file'
778 779
        data = '{"key1":"val1", "key2":"val2"}'
......
992 993

  
993 994
        r = pithos.object_put(
994 995
            obj,
995
            content_type='application/octet-stream',
996
            content_type='text/x-python',
996 997
            data='H',
997 998
            metadata=dict(mkey1='mval1', mkey2='mval2'),
998 999
            permissions=dict(
......
1008 1009
        self.info('Append is OK')
1009 1010

  
1010 1011
        newf.seek(0)
1011
        # r = pithos.overwrite_object(obj, 0, 10, newf, 'text/x-python')
1012
        # r = pithos.object_get(obj)
1013
        # print r.text, r.headers
1014
        # self.assertTrue(r.text.startswith('ello!'))
1015
        # self.assertEqual(r.headers['content-type'], 'text/x-python')
1016
        # self.info('Overwrite (involves content-legth/range/type) is OK')
1017
        self.info('ATTENTION: Overwrite is probably NOT OK')
1018
        #  This is just to mock the effects of the commented action
1019
        pithos.object_delete(obj)
1020
        pithos.upload_object(obj, newf, content_type='text/x-python')
1021
        r = pithos.object_post(
1022
            obj,
1023
            update=True,
1024
            content_type='text/x-python',
1025
            metadata=dict(mkey1='mval1', mkey2='mval2'),
1026
            permissions=dict(
1027
                read=['accX:groupA', 'u1', 'u2'],
1028
                write=['u2', 'u3']))
1029
        #  ---
1012
        r = pithos.overwrite_object(obj, 0, 10, newf)
1013
        r = pithos.object_get(obj)
1014
        self.assertTrue(r.text.startswith('ello!'))
1015
        self.assertEqual(r.headers['content-type'], 'text/x-python')
1016
        self.info('Overwrite (involves content-legth/range/type) is OK')
1030 1017

  
1031 1018
        r = pithos.truncate_object(obj, 5)
1032 1019
        r = pithos.object_get(obj)
......
1087 1074
        r = pithos.get_object_info(obj)
1088 1075
        helloVersion = r['x-object-version']
1089 1076
        self.assertTrue('x-object-public' in r)
1090
        #self.assertEqual(r['content-type'], 'application/octet-srteam')
1091
        #self.info('If-etag-match is OK')
1092
        self.info('If-etag-match is probably not OK')
1077
        self.assertEqual(r['content-type'], 'text/x-python')
1078
        self.info('If-etag-match is OK')
1093 1079

  
1094 1080
        pithos.container = self.temp_containers[-1]
1095 1081
        pithos.create_object(obj)
......
1103 1089
            source_account='thisAccountWillNeverExist@adminland.com',
1104 1090
            source_version=helloVersion,
1105 1091
            data='12345',
1106
            success=(403, 202, 204))
1107
        self.assertEqual(r.status_code, 403)
1108
        self.info('Successfully failed with invalud user UUID')
1092
            success=(416, 202, 204))
1093
        self.assertEqual(r.status_code, 416)
1094
        self.info('Successfully failed with invalid user UUID')
1109 1095

  
1096
        pithos.upload_from_string(obj, '12345')
1110 1097
        r = pithos.object_post(
1111 1098
            obj,
1112 1099
            update=True,
1113 1100
            content_type='application/octet-srteam',
1114
            content_length=5,
1115
            content_range='bytes 1-5/*',
1116
            source_object='/%s/%s' % (self.temp_containers[-1], obj),
1101
            content_length=3,
1102
            content_range='bytes 1-3/*',
1103
            source_object='/%s/%s' % (self.temp_containers[-2], obj),
1117 1104
            source_account=pithos.account,
1118 1105
            source_version=helloVersion,
1119
            data='12345',
1106
            data='123',
1120 1107
            content_disposition='attachment; filename="fname.ext"')
1121 1108

  
1122 1109
        r = pithos.object_get(obj)
1123
        self.assertEqual(r.text, 'eello!')
1110
        self.assertEqual(r.text, '1ell5')
1124 1111
        self.info('Cross container POST with source-version/account are OK')
1125 1112

  
1126 1113
        self.assertTrue('content-disposition' in r.headers)
......
1151 1138

  
1152 1139
        """We need to check transfer_encoding """
1153 1140

  
1141
    def test_075_object_delete(self):
1142
        """Test object DELETE"""
1143
        pithos = self.clients.pithos
1144
        obj = 'sample2post.file'
1145

  
1146
        r = pithos.object_delete(obj, until=1000000)
1147
        r = pithos.object_get(obj, success=(200, 404))
1148
        self.assertEqual(r.status_code, 200)
1149
        self.info('Successfully failed to delete with false "until"')
1150

  
1151
        r = pithos.object_delete(obj)
1152
        self.assertEqual(r.status_code, 204)
1153
        self.info('Status code is OK')
1154

  
1155
        r = pithos.object_get(obj, success=(200, 404))
1156
        self.assertEqual(r.status_code, 404)
1157
        self.info('Successfully failed to delete a deleted file')
1158

  
1154 1159
    @classmethod
1155 1160
    def tearDownClass(cls):  # noqa
1156 1161
        """Clean up"""

Also available in: Unified diff