Revision 1ff50540 snf-tools/synnefo_tools/burnin/pithos_tests.py
b/snf-tools/synnefo_tools/burnin/pithos_tests.py | ||
---|---|---|
82 | 82 |
pithos = self.clients.pithos |
83 | 83 |
for i in range(1, 3): |
84 | 84 |
cont_name = "cont%s_%s%s" % ( |
85 |
i, self.run_id, random.randint(1000, 9999)) |
|
85 |
i, self.run_id or 0, random.randint(1000, 9999))
|
|
86 | 86 |
self._create_pithos_container(cont_name) |
87 | 87 |
pithos.container, obj = cont_name, 'shared_file' |
88 | 88 |
pithos.create_object(obj) |
... | ... | |
169 | 169 |
self.assertTrue('x-account-meta-' + mprefix + '2' not in r) |
170 | 170 |
self.info('Temporary account meta are removed') |
171 | 171 |
|
172 |
def test_020_container_head(self): |
|
173 |
"""Test container HEAD""" |
|
174 |
pithos = self.clients.pithos |
|
175 |
r = pithos.container_head() |
|
176 |
self.assertEqual(r.status_code, 204) |
|
177 |
self.info('Status code is OK') |
|
178 |
|
|
179 |
r = pithos.container_head(until=1000000, success=(204, 404)) |
|
180 |
self.assertEqual(r.status_code, 404) |
|
181 |
self.info('Until works') |
|
182 |
|
|
183 |
for format in pithos.DATE_FORMATS: |
|
184 |
now_formated = self.now_unformated.strftime(format) |
|
185 |
r1 = pithos.container_head( |
|
186 |
if_modified_since=now_formated, success=(204, 304, 412)) |
|
187 |
r2 = pithos.container_head( |
|
188 |
if_unmodified_since=now_formated, success=(204, 304, 412)) |
|
189 |
self.assertNotEqual(r1.status_code, r2.status_code) |
|
190 |
|
|
191 |
k = 'metakey%s' % random.randint(1000, 9999) |
|
192 |
pithos.set_container_meta({k: 'our value'}) |
|
193 |
r = pithos.get_container_meta() |
|
194 |
k = 'x-container-meta-%s' % k |
|
195 |
self.assertIn(k, r) |
|
196 |
self.assertEqual('our value', r[k]) |
|
197 |
self.info('Container meta exists') |
|
198 |
|
|
172 | 199 |
# def test_050_stop_test(self): |
173 | 200 |
# """STOP TESTING ALREADY""" |
174 | 201 |
# self.assertTrue(False) |
... | ... | |
190 | 217 |
names = [n['name'] for n in self.containers] |
191 | 218 |
while True: |
192 | 219 |
rand_num = random.randint(1000, 9999) |
193 |
rand_name = "%s%s" % (self.run_id, rand_num) |
|
220 |
rand_name = "%s%s" % (self.run_id or 0, rand_num)
|
|
194 | 221 |
self.info("Trying container name %s", rand_name) |
195 | 222 |
if rand_name not in names: |
196 | 223 |
break |
... | ... | |
258 | 285 |
@classmethod |
259 | 286 |
def tearDownClass(cls): # noqa |
260 | 287 |
"""Clean up""" |
288 |
print cls.created_container |
|
261 | 289 |
if cls.created_container is not None: |
262 | 290 |
cls.clients.pithos.del_container(delimiter='/') |
263 | 291 |
cls.clients.pithos.purge_container() |
Also available in: Unified diff