|  | 
| 18 | 18 | from qiita_client.qiita_client import (QiitaClient, _format_payload, | 
| 19 | 19 |                                        ArtifactInfo) | 
| 20 | 20 | from qiita_client.testing import PluginTestCase, URL | 
| 21 |  | -from qiita_client.exceptions import BadRequestError | 
|  | 21 | +from qiita_client.exceptions import BadRequestError, ForbiddenError | 
| 22 | 22 | 
 | 
| 23 | 23 | CLIENT_ID = '19ndkO3oMKsoChjVVWluF7QkxHRfYhTKSFbAVt8IhK7gZgDaO4' | 
| 24 | 24 | BAD_CLIENT_ID = 'NOT_A_CLIENT_ID' | 
| @@ -497,12 +497,17 @@ def test_delete_file_from_central(self): | 
| 497 | 497 |             self.qclient._plugincoupling = protocol | 
| 498 | 498 | 
 | 
| 499 | 499 |             # deposit a test file | 
| 500 |  | -            fp_test = join(cwd, 'deletme_%s.txt' % protocol) | 
|  | 500 | +            fp_test = join(cwd, 'deleteme_%s.txt' % protocol) | 
| 501 | 501 |             makedirs(cwd, exist_ok=True) | 
| 502 | 502 |             with open(fp_test, 'w') as f: | 
| 503 | 503 |                 f.write('This is a testfile content\n') | 
| 504 | 504 |             self.clean_up_files.append(fp_test) | 
| 505 |  | -            self.qclient.push_file_to_central(fp_test) | 
|  | 505 | +            try: | 
|  | 506 | +                self.qclient.push_file_to_central(fp_test) | 
|  | 507 | +            except ForbiddenError as e: | 
|  | 508 | +                # previous test instances might not have cleaned this file | 
|  | 509 | +                # properly if ran with https protocol | 
|  | 510 | +                pass | 
| 506 | 511 | 
 | 
| 507 | 512 |             # sanity check that test file has been deposited correctly | 
| 508 | 513 |             fp_obs = self.qclient.fetch_file_from_central(fp_test) | 
|  | 
0 commit comments