azure_system_helpers_8.py 797 B

12345678910111213141516
  1. def prepare_share(cls, share_name: str, azure_fileshare_conn_id: str, file_name: str, directory: str):
  2. """
  3. Create share with a file in given directory. If directory is None, file is in root dir.
  4. """
  5. cls.create_share(share_name=share_name, azure_fileshare_conn_id=azure_fileshare_conn_id)
  6. cls.create_directory(
  7. share_name=share_name, azure_fileshare_conn_id=azure_fileshare_conn_id, directory=directory
  8. )
  9. string_data = "".join(random.choice(string.ascii_letters) for _ in range(1024))
  10. cls.upload_file_from_string(
  11. string_data=string_data,
  12. share_name=share_name,
  13. azure_fileshare_conn_id=azure_fileshare_conn_id,
  14. file_name=file_name,
  15. directory=directory,
  16. )