Beispiel #1
0
 def create_dir(dvc, url):
     config = {
         "url": url,
         "gdrive_service_account_email": "test",
         "gdrive_service_account_p12_file_path": "test.p12",
         "gdrive_use_service_account": True,
     }
     tree = GDriveRemoteTree(dvc, config)
     tree._gdrive_create_dir("root", tree.path_info.path)
Beispiel #2
0
def gdrive(make_tmp_dir):
    if not GDrive.should_test():
        pytest.skip("no gdrive")

    # NOTE: temporary workaround
    tmp_dir = make_tmp_dir("gdrive", dvc=True)

    ret = GDrive(GDrive.get_url())
    tree = GDriveRemoteTree(tmp_dir.dvc, ret.config)
    tree._gdrive_create_dir("root", tree.path_info.path)
    return ret
Beispiel #3
0
    def test_drive(self, dvc):
        tree = GDriveRemoteTree(dvc, self.CONFIG)
        os.environ[GDriveRemoteTree.
                   GDRIVE_CREDENTIALS_DATA] = USER_CREDS_TOKEN_REFRESH_ERROR
        with pytest.raises(GDriveAuthError):
            assert tree._drive

        os.environ[GDriveRemoteTree.GDRIVE_CREDENTIALS_DATA] = ""
        tree = GDriveRemoteTree(dvc, self.CONFIG)
        os.environ[GDriveRemoteTree.
                   GDRIVE_CREDENTIALS_DATA] = USER_CREDS_MISSED_KEY_ERROR
        with pytest.raises(GDriveAuthError):
            assert tree._drive
Beispiel #4
0
 def __init__(self, dvc):
     tree = GDriveRemoteTree(dvc, self.config)
     tree._gdrive_create_dir("root", tree.path_info.path)
Beispiel #5
0
 def test_init(self, dvc):
     tree = GDriveRemoteTree(dvc, self.CONFIG)
     assert str(tree.path_info) == self.CONFIG["url"]