repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/spec/models/tag_spec.rb | spec/models/tag_spec.rb | # frozen_string_literal: true
# == Schema Information
#
# Table name: tags
#
# id :integer not null, primary key
# name :string(255) default("latest"), not null
# repository_id :integer not null
# created_at :datetime not null
# updated_at :datetime ... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/spec/models/team_user_spec.rb | spec/models/team_user_spec.rb | # frozen_string_literal: true
# == Schema Information
#
# Table name: team_users
#
# id :integer not null, primary key
# user_id :integer
# team_id :integer
# created_at :datetime not null
# updated_at :datetime not null
# role :integer default("viewer")
#
# ... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/spec/models/namespace_spec.rb | spec/models/namespace_spec.rb | # frozen_string_literal: true
# == Schema Information
#
# Table name: namespaces
#
# id :integer not null, primary key
# name :string(255)
# created_at :datetime not null
# updated_at :datetime not null
# team_id :integer
# registry_id :integer not null
# ... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/spec/models/webhook_delivery_spec.rb | spec/models/webhook_delivery_spec.rb | # frozen_string_literal: true
# == Schema Information
#
# Table name: webhook_deliveries
#
# id :integer not null, primary key
# webhook_id :integer
# uuid :string(255)
# status :integer
# request_header :text(65535)
# request_body :text(65535)
# response_heade... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/spec/models/comment_spec.rb | spec/models/comment_spec.rb | # frozen_string_literal: true
# == Schema Information
#
# Table name: comments
#
# id :integer not null, primary key
# body :text(65535)
# repository_id :integer
# created_at :datetime not null
# updated_at :datetime not null
# user_id :integer
#
# Indexes... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/spec/models/registry_spec.rb | spec/models/registry_spec.rb | # frozen_string_literal: true
# == Schema Information
#
# Table name: registries
#
# id :integer not null, primary key
# name :string(255) not null
# hostname :string(255) not null
# created_at :datetime not null
# updated_at :datetime ... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/spec/models/application_token_spec.rb | spec/models/application_token_spec.rb | # frozen_string_literal: true
# == Schema Information
#
# Table name: application_tokens
#
# id :integer not null, primary key
# application :string(255) not null
# token_hash :string(255) not null
# token_salt :string(255) not null
# user_id :integer not null
#
# I... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/spec/models/user_spec.rb | spec/models/user_spec.rb | # frozen_string_literal: true
# == Schema Information
#
# Table name: users
#
# id :integer not null, primary key
# username :string(255) default(""), not null
# email :string(255) default("")
# encrypted_password :string(255) default("... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/spec/models/namespace/auth_scope_spec.rb | spec/models/namespace/auth_scope_spec.rb | # frozen_string_literal: true
require "rails_helper"
describe Namespace::AuthScope, type: :model do
let!(:registry) { create(:registry) }
it "handles the global namespace" do
nm = Namespace.first
scope = Namespace::AuthScope.new(registry, "registry:busybox:pull")
expect(scope.resource.id).to eq nm.id... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/spec/models/registry/auth_scope_spec.rb | spec/models/registry/auth_scope_spec.rb | # frozen_string_literal: true
require "rails_helper"
describe Registry::AuthScope, type: :model do
describe "registries" do
it "raises an exception if there's no registry" do
reg = Registry.new(hostname: "host", name: "name")
scope = Registry::AuthScope.new(reg, "scope:string:lala")
expect do
... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/spec/api/helpers/namespaces_spec.rb | spec/api/helpers/namespaces_spec.rb | # frozen_string_literal: true
require "rails_helper"
RSpec.describe ::API::Helpers::Namespaces, type: :helper do
let!(:registry) { create(:registry) }
let!(:user) { create(:admin) }
let!(:loser) { create(:user) }
let!(:team) { create(:team, owners: [user]) }
let!(:namespace) { create(:namespa... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/spec/api/v2/ping_spec.rb | spec/api/v2/ping_spec.rb | # frozen_string_literal: true
require "rails_helper"
describe "/v2 ping" do
let(:auth_mech) { ActionController::HttpAuthentication::Basic }
let(:password) { "this is a test" }
let(:user) { create(:user, password: password) }
# TODO: de-dup with tokens api spec
let(:valid_auth_header) do
{ "HTTP_AUTHORIZ... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/spec/api/v2/token_spec.rb | spec/api/v2/token_spec.rb | # frozen_string_literal: true
require "rails_helper"
describe "/v2/token", type: :request do
describe "get token" do
def parse_token(body)
token = JSON.parse(body)["token"]
JWT.decode(token, nil, false, leeway: 2)[0]
end
let(:auth_mech) { ActionController::HttpAuthentication::Basic }
le... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/spec/api/v2/events_spec.rb | spec/api/v2/events_spec.rb | # frozen_string_literal: true
require "rails_helper"
describe "/v2/token" do
describe "create" do
let(:data) { { "events" => [] } }
it "handles the notification and accepts it" do
expect(Portus::RegistryNotification).to receive(:process!)
post v2_webhooks_events_url, params: data.to_json, heade... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/spec/api/grape_api/v1/repositories_spec.rb | spec/api/grape_api/v1/repositories_spec.rb | # frozen_string_literal: true
require "rails_helper"
describe API::V1::Repositories, type: :request do
let!(:admin) { create(:admin) }
let!(:user) { create(:user) }
let!(:owner) { create(:user) }
let!(:admin_token) { create(:application_token, user: admin) }
let!(:owner_token) { create(:application_token, ... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/spec/api/grape_api/v1/version_spec.rb | spec/api/grape_api/v1/version_spec.rb | # frozen_string_literal: true
require "rails_helper"
describe API::Version, type: :request do
let!(:admin) { create(:admin) }
let!(:token) { create(:application_token, user: admin) }
before do
@header = build_token_header(token)
end
context "GET /api/version" do
it "returns the proper versioning" ... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/spec/api/grape_api/v1/vulnerabilities_spec.rb | spec/api/grape_api/v1/vulnerabilities_spec.rb | # frozen_string_literal: true
require "rails_helper"
describe API::V1::Vulnerabilities, type: :request do
let!(:admin) { create(:admin) }
let!(:token) { create(:application_token, user: admin) }
let!(:public_namespace) do
create(:namespace,
visibility: Namespace.visibilities[:visibility_public],
... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/spec/api/grape_api/v1/root_spec.rb | spec/api/grape_api/v1/root_spec.rb | # frozen_string_literal: true
require "rails_helper"
# TestAPI implements a MethodNotAllowed endpoint.
class TestAPI < Grape::API
version "v1", using: :path
get "test" do
raise Grape::Exceptions::MethodNotAllowed, "method not allowed"
end
end
# Re-opening ::API::RootAPI to mount the TestAPI endpoints.
cla... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/spec/api/grape_api/v1/tags_spec.rb | spec/api/grape_api/v1/tags_spec.rb | # frozen_string_literal: true
require "rails_helper"
describe API::V1::Tags, type: :request do
let!(:admin) { create(:admin) }
let!(:token) { create(:application_token, user: admin) }
let!(:public_namespace) do
create(:namespace,
visibility: Namespace.visibilities[:visibility_public],
... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/spec/api/grape_api/v1/namespaces_spec.rb | spec/api/grape_api/v1/namespaces_spec.rb | # frozen_string_literal: true
require "rails_helper"
describe API::V1::Namespaces, type: :request do
let!(:admin) { create(:admin) }
let!(:owner) { create(:user) }
let!(:contributor) { create(:user) }
let!(:viewer) { create(:user) }
let!(:user) { create(:user) }
let!(:admin_token) { create(:application_to... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/spec/api/grape_api/v1/users_spec.rb | spec/api/grape_api/v1/users_spec.rb | # frozen_string_literal: true
require "rails_helper"
describe API::V1::Users, type: :request do
let(:user_data) do
{
username: "solomon",
email: "solomon@example.org",
password: "password",
display_name: "Solomon Gandy"
}
end
before do
@admin = create :admin
... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/spec/api/grape_api/v1/application_tokens_spec.rb | spec/api/grape_api/v1/application_tokens_spec.rb | # frozen_string_literal: true
require "rails_helper"
describe API::V1::Users, type: :request do
before do
@admin = create :admin
token = create :application_token, user: @admin
@header = build_token_header(token)
APP_CONFIG["first_user_admin"] = { "enabled" => true }
end
context "GET /api/v1/u... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/spec/api/grape_api/v1/registries_spec.rb | spec/api/grape_api/v1/registries_spec.rb | # frozen_string_literal: true
require "rails_helper"
describe API::V1::Registries, type: :request do
before do
admin = create :admin
token = create :application_token, user: admin
@header = build_token_header(token)
end
context "POST /api/v1/registries" do
let(:data) do
{
registry... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/spec/api/grape_api/v1/health_spec.rb | spec/api/grape_api/v1/health_spec.rb | # frozen_string_literal: true
require "rails_helper"
require "ostruct"
require "portus/registry_client"
# Helper for the tests on the database that simply calls :health and returns the
# JSON message for the database component.
def db_helper_msg
get "/api/v1/health"
data = JSON.parse(response.body)
data["datab... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/spec/api/grape_api/v1/teams_spec.rb | spec/api/grape_api/v1/teams_spec.rb | # frozen_string_literal: true
require "rails_helper"
describe API::V1::Teams, type: :request do
let!(:admin) { create(:admin) }
let!(:user) { create(:user) }
let!(:token) { create(:application_token, user: admin) }
let!(:user_token) { create(:application_token, user: user) }
let!(:hidden_team) do
create... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/spec/views/help/index.html.slim_spec.rb | spec/views/help/index.html.slim_spec.rb | # frozen_string_literal: true
require "rails_helper"
describe "help/index" do
it "renders the page successfully" do
render
expect(assert_select("h5").text).to eq "Help"
end
end
| ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/spec/views/public_activity/team/_remove_member.html.slim_spec.rb | spec/views/public_activity/team/_remove_member.html.slim_spec.rb | # frozen_string_literal: true
require "rails_helper"
describe "public_activity/team/_remove_member" do
let!(:admin) { create(:admin) }
let!(:user) { create(:user) }
let!(:team) { create(:team, owners: [admin]) }
before do
APP_CONFIG["display_name"] = { "enabled" => true }
@user = create(:u... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/spec/views/public_activity/team/_remove_member.csv.slim_spec.rb | spec/views/public_activity/team/_remove_member.csv.slim_spec.rb | # frozen_string_literal: true
require "rails_helper"
describe "public_activity/team/_remove_member.csv.slim" do
let!(:admin) { create(:admin) }
let!(:user) { create(:user) }
let!(:team) { create(:team, owners: [admin]) }
before do
APP_CONFIG["display_name"] = { "enabled" => true }
@user = ... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/spec/views/public_activity/webhook/_create.html.slim_spec.rb | spec/views/public_activity/webhook/_create.html.slim_spec.rb | # frozen_string_literal: true
require "rails_helper"
describe "public_activity/webhook/_create" do
# Create a registry and the admin user. This way we have a namespace for the
# webhooks that might be created by the different tests.
let!(:registry) { create(:registry) }
let!(:user) { create(:admin) }
b... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/spec/views/public_activity/webhook/_enabled.csv.slim_spec.rb | spec/views/public_activity/webhook/_enabled.csv.slim_spec.rb | # frozen_string_literal: true
require "rails_helper"
describe "public_activity/webhook/_enabled.csv.slim" do
# Create a registry and the admin user. This way we have a namespace for the
# webhooks that might be created by the different tests.
let!(:registry) { create(:registry) }
let!(:user) { create(:adm... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/spec/views/public_activity/webhook/_create.csv.slim_spec.rb | spec/views/public_activity/webhook/_create.csv.slim_spec.rb | # frozen_string_literal: true
require "rails_helper"
describe "public_activity/webhook/_create.csv.slim" do
# Create a registry and the admin user. This way we have a namespace for the
# webhooks that might be created by the different tests.
let!(:registry) { create(:registry) }
let!(:user) { create(:admi... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/spec/views/public_activity/webhook/_enabled.html.slim_spec.rb | spec/views/public_activity/webhook/_enabled.html.slim_spec.rb | # frozen_string_literal: true
require "rails_helper"
describe "public_activity/webhook/_enabled" do
# Create a registry and the admin user. This way we have a namespace for the
# webhooks that might be created by the different tests.
let!(:registry) { create(:registry) }
let!(:user) { create(:admin) }
... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/spec/views/public_activity/registry/_delete.csv.slim_spec.rb | spec/views/public_activity/registry/_delete.csv.slim_spec.rb | # frozen_string_literal: true
require "rails_helper"
describe "public_activity/webhook/_delete.csv.slim" do
let!(:registry) { create(:registry) }
let!(:user) { create(:admin) }
let!(:team) { create(:team, owners: [user]) }
let!(:namespace) { create(:namespace, team: team, regist... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/spec/views/public_activity/registry/_delete.html.slim_spec.rb | spec/views/public_activity/registry/_delete.html.slim_spec.rb | # frozen_string_literal: true
require "rails_helper"
describe "public_activity/webhook/_delete" do
let!(:registry) { create(:registry) }
let!(:user) { create(:admin) }
let!(:team) { create(:team, owners: [user]) }
let!(:namespace) { create(:namespace, team: team, registry: regis... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/spec/views/explore/index.html.slim_spec.rb | spec/views/explore/index.html.slim_spec.rb | # frozen_string_literal: true
require "rails_helper"
describe "explore/index", type: :view do
it "renders the page successfully" do
@repositories = []
render
assert_select("#explore_search")
end
end
| ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/spec/views/search/index.html.slim_spec.rb | spec/views/search/index.html.slim_spec.rb | # frozen_string_literal: true
require "rails_helper"
describe "search/index" do
context "regular render" do
let!(:registry) { create(:registry, hostname: "registry.test.lan") }
let!(:user) { create(:admin) }
let!(:team) { create(:team, owners: [user]) }
let!(:namespace) { create(:name... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/spec/lib/omni_auth/strategies/bitbucket_spec.rb | spec/lib/omni_auth/strategies/bitbucket_spec.rb | # frozen_string_literal: true
require "rails_helper"
describe OmniAuth::Strategies::Bitbucket do
subject { described_class.new({}) }
let(:access_token) { instance_double("AccessToken", options: {}) }
let(:parsed_response) { instance_double("ParsedResponse") }
let(:response) { instance_double("Response", pars... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/spec/lib/portus/mail_spec.rb | spec/lib/portus/mail_spec.rb | # frozen_string_literal: true
require "rails_helper"
describe ::Portus::Mail::Utils do
let(:no_smtp) do
{
"from" => "lala@example.com",
"name" => "test",
"smtp" => { "enabled": false }
}.freeze
end
let(:basic) do
{
"from" => "lala@example.com",
"name" => "test",
... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/spec/lib/portus/security_spec.rb | spec/lib/portus/security_spec.rb | # frozen_string_literal: true
require "rails_helper"
describe ::Portus::Security do
describe "#enabled?" do
it "is disabled if no backend has been configured" do
APP_CONFIG["security"] = {
"clair" => {
"server" => ""
}, "zypper" => {
"server" => ""
}, "dummy" =>... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/spec/lib/portus/deprecation_error_spec.rb | spec/lib/portus/deprecation_error_spec.rb | # frozen_string_literal: true
require "rails_helper"
describe Portus::DeprecationError do
subject(:error) { described_class.new(message) }
let(:message) { "example" }
context "#to_s" do
subject { error.to_s }
it "prefixes the message with [DEPRECATED]" do
is_expected.to eq "[DEPRECATED] #{messa... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/spec/lib/portus/registry_notification_spec.rb | spec/lib/portus/registry_notification_spec.rb | # frozen_string_literal: true
require "rails_helper"
describe Portus::RegistryNotification do
let(:body) { ::Portus::Fixtures::RegistryEvent::BODY.dup }
let(:relevant) { ::Portus::Fixtures::RegistryEvent::RELEVANT.dup }
let(:delete) { ::Portus::Fixtures::RegistryEvent::DELETE.dup }
let(:version23) { ... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/spec/lib/portus/migrate_spec.rb | spec/lib/portus/migrate_spec.rb | # frozen_string_literal: true
require "rails_helper"
describe Portus::Migrate do
end
| ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/spec/lib/portus/request_error_spec.rb | spec/lib/portus/request_error_spec.rb | # frozen_string_literal: true
describe ::Portus::RequestError do
it "sumarizes the given request error" do
e = StandardError.new
expect do
raise ::Portus::RequestError.new(exception: e, message: "something")
end.to raise_error(::Portus::RequestError, "StandardError: something")
end
end
| ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/spec/lib/portus/jwt_token_spec.rb | spec/lib/portus/jwt_token_spec.rb | # frozen_string_literal: true
require "rails_helper"
# Let's open up some instance variables for testing purposes.
Portus::JwtToken.class_eval { attr_reader :account, :service }
describe Portus::JwtToken do
let(:mock) { described_class.new("", "", nil) }
let(:registry) { create(:registry) }
let(:scope) ... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/spec/lib/portus/db_spec.rb | spec/lib/portus/db_spec.rb | # frozen_string_literal: true
require "rails_helper"
describe Portus::DB do
describe "ping" do
it "returns :ready on the usual case" do
expect(described_class.ping).to eq :ready
end
it "returns :empty if the DB is still initializing" do
allow(::Portus::DB).to receive(:migrations?).and_retur... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/spec/lib/portus/registry_client_spec.rb | spec/lib/portus/registry_client_spec.rb | # frozen_string_literal: true
require "rails_helper"
# The RegistryClient defaults to the "portus" user if no credentials were
# given. This mock class serves to test a class that misses the credentials.
class RegistryClientMissingCredentials < Portus::RegistryClient
def initialize(host)
super(host)
@userna... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/spec/lib/portus/background/garbage_collector_spec.rb | spec/lib/portus/background/garbage_collector_spec.rb | # frozen_string_literal: true
require "rails_helper"
require "portus/background/garbage_collector"
describe ::Portus::Background::GarbageCollector do
let(:old_tag) { (APP_CONFIG["delete"]["garbage_collector"]["older_than"].to_i + 10).days.ago }
let(:recent_tag) { (APP_CONFIG["delete"]["garbage_collector"]["old... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/spec/lib/portus/background/security_scanning_spec.rb | spec/lib/portus/background/security_scanning_spec.rb | # frozen_string_literal: true
require "rails_helper"
require "portus/background/security_scanning"
describe ::Portus::Background::SecurityScanning do
let!(:admin) { create(:admin) }
let!(:token) { create(:application_token, user: admin) }
let!(:registry) { create(:registry, hostname: "my.registry:5000", use_s... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/spec/lib/portus/background/ldap_spec.rb | spec/lib/portus/background/ldap_spec.rb | # frozen_string_literal: true
require "rails_helper"
require "portus/background/ldap"
describe ::Portus::Background::LDAP do
describe "#sleep_value" do
it "returns always 10" do
expect(subject.sleep_value).to eq 10
end
end
describe "#work?" do
it "returns false if LDAP is disabled" do
A... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/spec/lib/portus/background/sync_spec.rb | spec/lib/portus/background/sync_spec.rb | # frozen_string_literal: true
require "rails_helper"
require "portus/background/sync"
# Just opens up protected methods so they can be used in the test suite.
class SyncMock < ::Portus::Background::Sync
def update_registry!(catalog)
super
end
end
describe ::Portus::Background::Sync do
before do
APP_CON... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/spec/lib/portus/background/registry_spec.rb | spec/lib/portus/background/registry_spec.rb | # frozen_string_literal: true
require "rails_helper"
require "portus/background/registry"
describe ::Portus::Background::Registry do
describe "#sleep_value" do
it "returns always 2" do
expect(subject.sleep_value).to eq 2
end
end
describe "#work?" do
it "always returns true" do
expect(su... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/spec/lib/portus/ldap/search_spec.rb | spec/lib/portus/ldap/search_spec.rb | # frozen_string_literal: true
describe ::Portus::LDAP::Search do
let(:success) { OpenStruct.new(code: 0) }
let(:failure) { OpenStruct.new(code: 1) }
describe "#with_error_message" do
it "returns nil if LDAP is disabled" do
APP_CONFIG["ldap"]["enabled"] = false
expect(subject.with_error_message(... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/spec/lib/portus/ldap/configuration_spec.rb | spec/lib/portus/ldap/configuration_spec.rb | # frozen_string_literal: true
require "rails_helper"
describe ::Portus::LDAP::Configuration do
before do
APP_CONFIG["ldap"]["enabled"] = true
end
context "enabled?" do
it "returns false if LDAP is disabled" do
APP_CONFIG["ldap"]["enabled"] = false
params = { user: { username: "name", passwo... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/spec/lib/portus/ldap/authenticatable_spec.rb | spec/lib/portus/ldap/authenticatable_spec.rb | # frozen_string_literal: true
require "ostruct"
require "rails_helper"
class ConnectionMock
def initialize(n)
@n = n
@ary = Array.new(n, true)
end
def bind_as(_param)
@n -= 1
@n == 0
end
def search(_param)
@ary.pop
@ary
end
end
# AuthenticatableMock is a thin layer on top of ::P... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/spec/lib/portus/security/clair_spec.rb | spec/lib/portus/security/clair_spec.rb | # frozen_string_literal: true
require "rails_helper"
require "portus/security"
def expect_cve_match(cves, given, expected)
cves.each do |cve|
r = given.find { |x| x["Name"] == cve }
e = expected.find { |x| x["Name"] == cve }
expect(r).to include(e)
end
end
describe ::Portus::SecurityBackend::Clair d... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/examples/development/compose/init.rb | examples/development/compose/init.rb | # frozen_string_literal: true
#
# First of all, wait until the database is up and running. This is useful in
# containerized scenarios.
#
begin
::Portus::DB.wait_until(:ready) do |status|
system("bundle exec rake db:setup") if status == :missing
end
rescue ::Portus::DB::TimeoutReachedError => e
Rails.logger... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/tasks/helpers.rb | lib/tasks/helpers.rb | # frozen_string_literal: true
# :nocov:
# rubocop:disable Rails/Exit
# rubocop:disable Rails/Output
module Helpers
# Check that there are the amount of required arguments and they are not blank.
def self.check_arguments!(args, required, optional = 0)
if args.count != required && args.count != required + option... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/omni_auth/strategies/bitbucket.rb | lib/omni_auth/strategies/bitbucket.rb | # frozen_string_literal: true
require "active_support/core_ext/module/aliasing"
require "omniauth-oauth2"
module OmniAuth
module Strategies
# Bitbucket implements the OAuth2 protocol for bitbucket.
class Bitbucket < OmniAuth::Strategies::OAuth2
option :name, "bitbucket"
option :client_options,
... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/api/version.rb | lib/api/version.rb | # frozen_string_literal: true
module API
# Version implements the main "/version" endpoint. It's not versioned because
# this is meant to be stable throughout any version of the API.
class Version < Grape::API
before do
authorization!(force_admin: false)
end
desc "Fetch the version of Portus",... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/api/root_api.rb | lib/api/root_api.rb | # frozen_string_literal: true
require "grape-swagger"
require "api/entities"
require "api/helpers"
require "api/v1/pagination_params"
require "api/v1/ordering_params"
require "api/v1/application_tokens"
require "api/v1/health"
require "api/v1/namespaces"
require "api/v1/registries"
require "api/v1/repositories"
requi... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/api/helpers.rb | lib/api/helpers.rb | # frozen_string_literal: true
require "portus/auth_from_token"
require "api/helpers/errors"
require "api/helpers/teams"
require "api/helpers/comments"
require "api/helpers/webhooks"
require "api/helpers/namespaces"
require "api/helpers/repositories"
require "api/helpers/pagination"
require "api/helpers/ordering"
modu... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/api/entities.rb | lib/api/entities.rb | # frozen_string_literal: true
require "api/helpers"
module API
# Entities is a module that groups all the classes to be used as Grape
# entities.
module Entities
# General entities
class ApiErrors < Grape::Entity
expose :message, documentation: {
type: String,
desc: "Error message... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/api/helpers/comments.rb | lib/api/helpers/comments.rb | # frozen_string_literal: true
module API
module Helpers
# Helpers of teams
module Comments
# Return true if current_user has permission to destroy a comment
# Returns false otherwise
def can_destroy_comment?(comment, user)
CommentPolicy.new(user, comment).destroy?
end
end
... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/api/helpers/webhooks.rb | lib/api/helpers/webhooks.rb | # frozen_string_literal: true
module API
module Helpers
# Helpers of webhooks
module Webhooks
# Return true if user has permission to update a webhook
# Returns false otherwise
def can_manage_webhook?(webhook, user)
WebhookPolicy.new(user, webhook).update?
end
def can_d... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/api/helpers/errors.rb | lib/api/helpers/errors.rb | # frozen_string_literal: true
require "portus/auth_from_token"
module API
module Helpers
# Errors implements helper methods for API error responses.
module Errors
# Sends a `400 Bad Request` error with a possible message as the response
# body.
def bad_request!(msg = "Bad Request")
... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/api/helpers/pagination.rb | lib/api/helpers/pagination.rb | # frozen_string_literal: true
# Extracted and adapted from https://gitlab.com/gitlab-org/gitlab-ce/blob/master/lib/api/helpers/pagination.rb
module API
module Helpers
# Pagination implements a helper responsible for the resource entries pagination
# that can be customized through request parameters like `al... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/api/helpers/namespaces.rb | lib/api/helpers/namespaces.rb | # frozen_string_literal: true
module API
module Helpers
# Helpers of namespaces
module Namespaces
def can_manage_namespace?(namespace, user)
NamespacePolicy.new(user, namespace).update?
end
def can_destroy_namespace?(namespace, user)
NamespacePolicy.new(user, namespace).des... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/api/helpers/teams.rb | lib/api/helpers/teams.rb | # frozen_string_literal: true
module API
module Helpers
# Helpers of teams
module Teams
# Prettify the role of the given user within the given team. You can pass
# the value to be returned if this user does not belong to the team with
# the `empty` argument.
def role_within_team(user,... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/api/helpers/repositories.rb | lib/api/helpers/repositories.rb | # frozen_string_literal: true
module API
module Helpers
# Helpers of repositories
module Repositories
def can_destroy_repository?(repository, user)
RepositoryPolicy.new(user, repository).destroy?
end
end
end
end
| ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/api/helpers/application_tokens.rb | lib/api/helpers/application_tokens.rb | # frozen_string_literal: true
module API
module Helpers
# Helpers regarding the management of authentication tokens. This module
# mostly contains methods that are shared across different paths.
module ApplicationTokens
# Create an application token for the given user with the given
# ID. The... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/api/helpers/ordering.rb | lib/api/helpers/ordering.rb | # frozen_string_literal: true
module API
module Helpers
# Ordering implements a helper responsible for the resource entries ordering that
# can be customized through request parameters like `sort_attr` and `sort_order`.
module Ordering
def order(relation)
relation.order(sanitized_attr(relat... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/api/v1/ordering_params.rb | lib/api/v1/ordering_params.rb | # frozen_string_literal: true
module API
module V1
# Concern for declaration of ordering parameters.
#
# @example
# class ApiResource < Grape::API
# include OrderingParams
#
# params do
# use :ordering
# end
# end
module OrderingParams
extend Ac... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/api/v1/users.rb | lib/api/v1/users.rb | # frozen_string_literal: true
require "api/helpers/application_tokens"
module API
module V1
# Users implements all the endpoints regarding users
class Users < Grape::API
include PaginationParams
include OrderingParams
version "v1", using: :path
helpers ::API::Helpers::ApplicationTo... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/api/v1/namespaces.rb | lib/api/v1/namespaces.rb | # frozen_string_literal: true
module API
module V1
# Namespaces implements all the endpoints regarding namespaces.
class Namespaces < Grape::API
include PaginationParams
include OrderingParams
version "v1", using: :path
resource :namespaces do
before do
authorizati... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/api/v1/vulnerabilities.rb | lib/api/v1/vulnerabilities.rb | # frozen_string_literal: true
module API
module V1
# Tags implements all the endpoints regarding tags that have not been
# addressed in other classes.
class Vulnerabilities < Grape::API
version "v1", using: :path
resource :vulnerabilities do
before do
authorization!(force_a... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/api/v1/teams.rb | lib/api/v1/teams.rb | # frozen_string_literal: true
module API
module V1
class Teams < Grape::API
include PaginationParams
include OrderingParams
version "v1", using: :path
resource :teams do
before do
authorization!(force_admin: false)
end
desc "Returns list of teams",
... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/api/v1/repositories.rb | lib/api/v1/repositories.rb | # frozen_string_literal: true
module API
module V1
# Repositories implements all the endpoints regarding repositories and some
# endpoints regarding tags that might be convenient to use as a
# sub-resource.
class Repositories < Grape::API
include PaginationParams
include OrderingParams
... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/api/v1/health.rb | lib/api/v1/health.rb | # frozen_string_literal: true
require "portus/health"
module API
module V1
# Health implements endpoints that report on the health status of the API or
# other components.
class Health < Grape::API
version "v1", using: :path
desc "Ping this API", tags: ["health"], detail: "Returns 200 as a ... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/api/v1/registries.rb | lib/api/v1/registries.rb | # frozen_string_literal: true
module API
module V1
# Registries implements all the endpoints regarding registries.
class Registries < Grape::API
version "v1", using: :path
resource :registries do
before do
authorization!(force_admin: true)
end
desc "Returns a l... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/api/v1/application_tokens.rb | lib/api/v1/application_tokens.rb | # frozen_string_literal: true
require "api/helpers/application_tokens"
module API
module V1
# ApplicationTokens implements all the endpoints regarding application tokens.
class ApplicationTokens < Grape::API
version "v1", using: :path
helpers ::API::Helpers::ApplicationTokens
resource :u... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/api/v1/pagination_params.rb | lib/api/v1/pagination_params.rb | # frozen_string_literal: true
module API
module V1
# Concern for declaration of pagination parameters.
#
#
# @example
# class ApiResource < Grape::API
# include PaginationParams
#
# params do
# use :pagination
# end
# end
module PaginationParams
... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/api/v1/tags.rb | lib/api/v1/tags.rb | # frozen_string_literal: true
module API
module V1
# Tags implements all the endpoints regarding tags that have not been
# addressed in other classes.
class Tags < Grape::API
include PaginationParams
include OrderingParams
version "v1", using: :path
resource :tags do
bef... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/portus/test.rb | lib/portus/test.rb | # frozen_string_literal: true
# :nocov:
module ::Portus
# Test defines constants which are used in multiple places regarding
# integration tests.
class Test
LOCAL_IMAGE = "opensuse/portus:development"
HEAD_IMAGE = "opensuse/portus:head"
DEVELOPMENT_MATRIX = {
background: LOCAL_I... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/portus/security.rb | lib/portus/security.rb | # frozen_string_literal: true
require "portus/security_backends/clair"
require "portus/security_backends/dummy"
require "portus/security_backends/zypper"
module Portus
# Security offers methods that are useful for fetching vulnerabilities for the
# given repositories & tags.
class Security
# Supported backe... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/portus/jwt_token.rb | lib/portus/jwt_token.rb | # frozen_string_literal: true
require "portus/migrate"
module Portus
# This class implements the JSON Web Token as expected by the registry. Read
# the `spec` for more information:
#
# https://github.com/docker/distribution/blob/master/docs/spec/auth/token.md
#
class JwtToken
# The constructor takes... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/portus/auth_scope.rb | lib/portus/auth_scope.rb | # frozen_string_literal: true
module Portus
# This is the base class for AuthScope classes. An AuthScope class retrieves
# the information that can be extracted from a Docker scope string for the
# represented resource.
#
# An AuthScope class is required at least provide an implementation for the
# `resour... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/portus/request_error.rb | lib/portus/request_error.rb | # frozen_string_literal: true
module ::Portus
# RequestError wraps any exception that might arise when performing an HTTP
# request, and provides a common `msg` method. Moreover, all raised exceptions
# will also be logged.
class RequestError < StandardError
# Given an inner exception and a message, it bui... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/portus/db.rb | lib/portus/db.rb | # frozen_string_literal: true
module Portus
# The DB module has useful methods for DB purposes.
module DB
WAIT_TIMEOUT = 90
WAIT_INTERVAL = 5
# Pings the DB and returns a proper symbol depending on the situation:
# * ready: the database has been created and initialized.
# * empty: the dat... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/portus/errors.rb | lib/portus/errors.rb | # frozen_string_literal: true
module Portus
# Errors contain registry-specific errors that have no real implementation.
module Errors
# Networking errors given usually on this application. This is useful to
# catch a set of common networking issues on a single rescue statement.
NET = [SocketError, Open... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/portus/migrate.rb | lib/portus/migrate.rb | # frozen_string_literal: true
module Portus
# The Portus::Migrate module implements some methods that are used to handle a
# change from different versions of Portus where there is an old (and
# deprecated) way of doing things and a preferred new one.
module Migrate; end
end
| ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/portus/cmd.rb | lib/portus/cmd.rb | # frozen_string_literal: true
# :nocov:
require "pty"
module ::Portus
class Cmd
# Spawn a new command and return its exit status. It will print to stdout on
# real time.
def self.spawn(cmd)
success = true
::PTY.spawn(cmd) do |stdout, _, pid|
# rubocop:disable Lint/HandleExceptions
... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/portus/registry_client.rb | lib/portus/registry_client.rb | # frozen_string_literal: true
module Portus
# RegistryClient is a a layer between Portus and the Registry. Given a set of
# credentials, it's able to call to any endpoint in the registry API. Moreover,
# it also implements some handy methods on top of some of these endpoints (e.g.
# the `manifest` method for t... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/portus/http_helpers.rb | lib/portus/http_helpers.rb | # frozen_string_literal: true
require "net/http"
require "portus/errors"
require "portus/request_error"
module Portus
# Implements all the methods and classes that are needed by the RegistryClient.
# This separation has been done because this module deals with HTTP helpers and
# the authentication process. The ... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/portus/auth_from_token.rb | lib/portus/auth_from_token.rb | # frozen_string_literal: true
module Portus
# AuthFromToken includes methods for authenticating users through an
# application token. This may apply to either controllers or the Rest API, and
# hence is left as a separate library.
module AuthFromToken
# Authenticate the given user by token. The token is pa... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/portus/registry_notification.rb | lib/portus/registry_notification.rb | # frozen_string_literal: true
module Portus
# Handle an event as given by the Registry and processes it so it can be
# consumed later on.
class RegistryNotification
# An array with the events that a handler has to support.
HANDLED_EVENTS = %w[push delete pull].freeze
# It filters the event from the ... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/portus/health.rb | lib/portus/health.rb | # frozen_string_literal: true
require "portus/health_checks/db"
require "portus/health_checks/clair"
require "portus/health_checks/ldap"
require "portus/health_checks/registry"
module Portus
# Health contains methods for checking the status of the different relevant
# components.
class Health
CHECKS = [
... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/portus/mail.rb | lib/portus/mail.rb | # frozen_string_literal: true
module Portus
# Mail implements a set of utilities for mailing purposes.
module Mail
# ConfigurationError is raised when the given configuration has semantic
# problems (e.g. malformed emails).
class ConfigurationError < StandardError; end
# Utils is a set of utility ... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/portus/deprecation_error.rb | lib/portus/deprecation_error.rb | # frozen_string_literal: true
module Portus
# DeprecationError is the exception to be raised when certain functionality has been deprecated
# in the latest version and we want to provide migration instructions
class DeprecationError < StandardError
def to_s
"[DEPRECATED] " + super
end
end
end
| ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/portus/checks.rb | lib/portus/checks.rb | # frozen_string_literal: true
module Portus
# Performs some checks on runtime to validate that some settings from Portus
# are properly set.
module Checks
# Check whether certain requirements are met, like ssl configuration
# for production or having setup secrets.
# If they are not met, render a pag... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/portus/health_checks/db.rb | lib/portus/health_checks/db.rb | # frozen_string_literal: true
require "portus/db"
module Portus
module HealthChecks
# DB offers health check support for the database.
class DB
def self.name
"database"
end
def self.ready
case ::Portus::DB.ping
when :ready
["database is up-to-date", true]... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.