projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
15306: Adds integration tests with query string & form encoded params.
[arvados.git]
/
services
/
api
/
test
/
unit
/
repository_test.rb
diff --git
a/services/api/test/unit/repository_test.rb
b/services/api/test/unit/repository_test.rb
index 5acef1bb1e769ca0d1cbc7f6a80d124286b33aa8..cb562ef977200740e3d116889dad9ed1b9f55cb8 100644
(file)
--- a/
services/api/test/unit/repository_test.rb
+++ b/
services/api/test/unit/repository_test.rb
@@
-1,3
+1,7
@@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
require 'test_helper'
require 'helpers/git_test_helper'
require 'test_helper'
require 'helpers/git_test_helper'
@@
-19,15
+23,15
@@
class RepositoryTest < ActiveSupport::TestCase
def default_git_url(repo_name, user_name=nil)
if user_name
"git@git.%s.arvadosapi.com:%s/%s.git" %
def default_git_url(repo_name, user_name=nil)
if user_name
"git@git.%s.arvadosapi.com:%s/%s.git" %
- [Rails.configuration.
uuid_prefix
, user_name, repo_name]
+ [Rails.configuration.
ClusterID
, user_name, repo_name]
else
"git@git.%s.arvadosapi.com:%s.git" %
else
"git@git.%s.arvadosapi.com:%s.git" %
- [Rails.configuration.
uuid_prefix
, repo_name]
+ [Rails.configuration.
ClusterID
, repo_name]
end
end
def assert_server_path(path_tail, repo_sym)
end
end
def assert_server_path(path_tail, repo_sym)
- assert_equal(File.join(Rails.configuration.
git_repositories_dir
, path_tail),
+ assert_equal(File.join(Rails.configuration.
Git.Repositories
, path_tail),
repositories(repo_sym).server_path)
end
repositories(repo_sym).server_path)
end
@@
-35,8
+39,8
@@
class RepositoryTest < ActiveSupport::TestCase
{active: "active/", admin: "admin/", system_user: ""}.
each_pair do |user_sym, name_prefix|
{active: "active/", admin: "admin/", system_user: ""}.
each_pair do |user_sym, name_prefix|
- %w(a aa a0 aA Aa AA A0).each do |name|
- test "'#{name_prefix}#{name}' is a valid name for #{user_sym} repo" do
+ test "valid names for #{user_sym} repo" do
+ %w(a aa a0 aA Aa AA A0).each do |name|
repo = new_repo(user_sym, name: name_prefix + name)
assert(repo.valid?)
end
repo = new_repo(user_sym, name: name_prefix + name)
assert(repo.valid?)
end
@@
-51,8
+55,8
@@
class RepositoryTest < ActiveSupport::TestCase
refute(repo.valid?)
end
refute(repo.valid?)
end
- "\\.-_/!@#$%^&*()[]{}".each_char do |bad_char|
- test "name containing #{bad_char.inspect} is invalid for #{user_sym}" do
+ test "name containing bad char is invalid for #{user_sym}" do
+ "\\.-_/!@#$%^&*()[]{}".each_char do |bad_char|
repo = new_repo(user_sym, name: "#{name_prefix}bad#{bad_char}reponame")
refute(repo.valid?)
end
repo = new_repo(user_sym, name: "#{name_prefix}bad#{bad_char}reponame")
refute(repo.valid?)
end
@@
-108,6
+112,7
@@
class RepositoryTest < ActiveSupport::TestCase
test "fetch_url" do
repo = new_repo(:active, name: "active/fetchtest")
test "fetch_url" do
repo = new_repo(:active, name: "active/fetchtest")
+ repo.save
assert_equal(default_git_url("fetchtest", "active"), repo.fetch_url)
end
assert_equal(default_git_url("fetchtest", "active"), repo.fetch_url)
end
@@
-115,11
+120,13
@@
class RepositoryTest < ActiveSupport::TestCase
set_user_from_auth :admin
repo = Repository.new(owner_uuid: users(:system_user).uuid,
name: "fetchtest")
set_user_from_auth :admin
repo = Repository.new(owner_uuid: users(:system_user).uuid,
name: "fetchtest")
+ repo.save
assert_equal(default_git_url("fetchtest"), repo.fetch_url)
end
test "push_url" do
repo = new_repo(:active, name: "active/pushtest")
assert_equal(default_git_url("fetchtest"), repo.fetch_url)
end
test "push_url" do
repo = new_repo(:active, name: "active/pushtest")
+ repo.save
assert_equal(default_git_url("pushtest", "active"), repo.push_url)
end
assert_equal(default_git_url("pushtest", "active"), repo.push_url)
end
@@
-127,6
+134,7
@@
class RepositoryTest < ActiveSupport::TestCase
set_user_from_auth :admin
repo = Repository.new(owner_uuid: users(:system_user).uuid,
name: "pushtest")
set_user_from_auth :admin
repo = Repository.new(owner_uuid: users(:system_user).uuid,
name: "pushtest")
+ repo.save
assert_equal(default_git_url("pushtest"), repo.push_url)
end
assert_equal(default_git_url("pushtest"), repo.push_url)
end