Skip to content

Commit

Permalink
lint a random file (#3578)
Browse files Browse the repository at this point in the history
  • Loading branch information
osc-bot authored May 31, 2024
1 parent 792cc60 commit 04f2dd0
Showing 1 changed file with 25 additions and 22 deletions.
47 changes: 25 additions & 22 deletions apps/dashboard/test/rclone_helper.rb
Original file line number Diff line number Diff line change
@@ -1,27 +1,30 @@
# helper functions for tests that use rclone/remote files in files app
# frozen_string_literal: true

class ActiveSupport::TestCase
# helper functions for tests that use rclone/remote files in files app

# Avoid using local remote directly to detect cases where the path is valid on both the remote
# and posix file system
def remote_files_conf(root_dir)
{
OOD_REMOTE_FILES_ENABLED: 'true',
RCLONE_CONFIG_LOCAL_REMOTE_TYPE: 'local',
RCLONE_CONFIG_ALIAS_REMOTE_TYPE: 'alias',
RCLONE_CONFIG_ALIAS_REMOTE_REMOTE: "local_remote:#{root_dir}",
RCLONE_CONFIG: Rails.root.join('test/fixtures/config/rclone/rclone.conf').to_s
}
end
module ActiveSupport
class TestCase
# Avoid using local remote directly to detect cases where the path is valid on both the remote
# and posix file system
def remote_files_conf(root_dir)
{
OOD_REMOTE_FILES_ENABLED: 'true',
RCLONE_CONFIG_LOCAL_REMOTE_TYPE: 'local',
RCLONE_CONFIG_ALIAS_REMOTE_TYPE: 'alias',
RCLONE_CONFIG_ALIAS_REMOTE_REMOTE: "local_remote:#{root_dir}",
RCLONE_CONFIG: Rails.root.join('test/fixtures/config/rclone/rclone.conf').to_s
}
end

def with_rclone_conf(root_dir, &block)
conf = remote_files_conf(root_dir)
with_modified_env(conf, &block)
end
def with_rclone_conf(root_dir, &block)
conf = remote_files_conf(root_dir)
with_modified_env(conf, &block)
end

def with_extra_rclone_conf(root_dir, &block)
conf = remote_files_conf(root_dir)
.merge({OOD_RCLONE_EXTRA_CONFIG: Rails.root.join('test/fixtures/config/rclone/extra_config.conf').to_s})
with_modified_env(conf, &block)
def with_extra_rclone_conf(root_dir, &block)
conf = remote_files_conf(root_dir)
.merge({ OOD_RCLONE_EXTRA_CONFIG: Rails.root.join('test/fixtures/config/rclone/extra_config.conf').to_s })
with_modified_env(conf, &block)
end
end
end
end

0 comments on commit 04f2dd0

Please sign in to comment.