# Path: metatlas/io/rclone.py
# class RClone:
#     def __init__(self, rclone_path: str) -> None:
#     def config_file(self) -> Optional[str]:
#     def get_name_for_id(self, identifier: str) -> Optional[str]:
#     def copy_to_drive(self, source: str, drive: str, dest_path: str = None, progress: bool = False) -> None:
#     def get_id_for_path(self, path_string: str) -> str:
#     def path_to_url(self, path_string: str) -> str:
# def parse_path(path_string: str) -> Tuple[str, List[str]]:


import os
import subprocess
import pytest
from metatlas.io import rclone
""" Tests of RClone """
# pylint: disable=missing-function-docstring





def has_rclone():
    return os.system("rclone") == 256


def rclone_path():
    result = subprocess.run(["which", "rclone"], stdout=subprocess.PIPE, check=True)
    return result.stdout.decode("utf-8").rstrip()


def test_config_file01():
    rci = rclone.RClone("/bin/foobarz")
    assert rci.config_file() is None


@pytest.mark.skipif(not has_rclone(), reason="rclone not in PATH")
def test_config_file02():

# Path: metatlas/io/rclone.py
# class RClone:
#     def __init__(self, rclone_path: str) -> None:
#     def config_file(self) -> Optional[str]:
#     def get_name_for_id(self, identifier: str) -> Optional[str]:
#     def copy_to_drive(self, source: str, drive: str, dest_path: str = None, progress: bool = False) -> None:
#     def get_id_for_path(self, path_string: str) -> str:
#     def path_to_url(self, path_string: str) -> str:
# def parse_path(path_string: str) -> Tuple[str, List[str]]:


# Path: tests/unit/test_rclone.py
import os
import subprocess
import pytest
from metatlas.io import rclone

""" Tests of RClone """
# pylint: disable=missing-function-docstring





def has_rclone():
    return os.system("rclone") == 256


def rclone_path():
    result = subprocess.run(["which", "rclone"], stdout=subprocess.PIPE, check=True)
    return result.stdout.decode("utf-8").rstrip()


def test_config_file01():
    rci = rclone.RClone("/bin/foobarz")
    assert rci.config_file() is None


@pytest.mark.skipif(not has_rclone(), reason="rclone not in PATH")
def test_config_file02():

    rci = rclone.RClone(rclone_path())