def invoke(cls, web_client, channel, filepath): mimetype = FileTool.filepath2mimetype(filepath) filetype = SlackFiletype.mimetype2filetype(mimetype) j_files_upload_in = { "channels": channel, "file": filepath, "filename": os.path.basename(filepath), "filetype": filetype, } response = web_client.files_upload(**j_files_upload_in) return response
def test_01(self): filepath = os.path.join(os.path.dirname(FILE_DIR), "file_tool.py") hyp = FileTool.filepath2mimetype(filepath) self.assertEqual(hyp, MimetypeTool.V.TEXT_XPYTHON)