Upload a given file from the file_path to the bucket with the new name/path file_name.
(self, file_name, file_path)
| 44 | return self.bucket |
| 45 | |
| 46 | def upload_file(self, file_name, file_path): |
| 47 | """Upload a given file from the file_path to the bucket |
| 48 | with the new name/path file_name.""" |
| 49 | upload_key = self.get_key(file_name) |
| 50 | content_type = "text/plain" |
| 51 | if file_name.endswith(".html"): |
| 52 | content_type = "text/html" |
| 53 | elif file_name.endswith(".jpg"): |
| 54 | content_type = "image/jpeg" |
| 55 | elif file_name.endswith(".png"): |
| 56 | content_type = "image/png" |
| 57 | upload_key.Bucket().upload_file( |
| 58 | file_path, |
| 59 | file_name, |
| 60 | ExtraArgs={"ACL": "public-read", "ContentType": content_type}, |
| 61 | ) |
| 62 | |
| 63 | def upload_index_file( |
| 64 | self, test_address, timestamp, data_path, save_data_to_logs |
no test coverage detected