Revision 3b322804
Added by David Davis about 10 years ago
app/models/katello/content_view.rb | ||
---|---|---|
Katello::Actions::ContentViewCreate
|
||
end
|
||
|
||
CONTENT_DIR = "content_views"
|
||
|
||
before_destroy :confirm_not_promoted # RAILS3458: this needs to come before associations
|
||
|
||
belongs_to :organization, :inverse_of => :content_views, :class_name => "::Organization"
|
app/models/katello/kt_environment.rb | ||
---|---|---|
:exclusion => { :in => ["Library"], :message => N_(": '%s' is a built-in environment") % "Library", :unless => :library? }
|
||
validates :label, :presence => true, :uniqueness => {:scope => :organization_id,
|
||
:message => N_("of environment must be unique within one organization")},
|
||
:exclusion => { :in => ["Library"], :message => N_(": '%s' is a built-in environment") % "Library", :unless => :library?}
|
||
:exclusion => { :in => ["Library"], :message => N_(": '%s' is a built-in environment") % "Library", :unless => :library?},
|
||
:exclusion => { :in => [ContentView::CONTENT_DIR], :message => N_(": '%s' is a built-in environment") % ContentView::CONTENT_DIR }
|
||
validates_with Validators::KatelloNameFormatValidator, :attributes => :name
|
||
validates_with Validators::KatelloLabelFormatValidator, :attributes => :label
|
||
validates_with Validators::KatelloDescriptionFormatValidator, :attributes => :description
|
app/models/katello/repository.rb | ||
---|---|---|
:content_view_id => options[:content_view]).first
|
||
"#{org}/#{cve.label}/#{content_path}"
|
||
else
|
||
"#{org}/#{options[:content_view].label}/#{options[:version].version}/#{content_path}"
|
||
"#{org}/#{ContentView::CONTENT_DIR}/#{options[:content_view].label}/#{options[:version].version}/#{content_path}"
|
||
end
|
||
end
|
||
|
test/models/kt_environment_test.rb | ||
---|---|---|
assert_equal @library.products.uniq.sort, @library.products.sort
|
||
assert_operator @library.repositories.map(&:product).length, :>, @library.products.length
|
||
end
|
||
|
||
def test_content_view_label
|
||
env = @acme_corporation.environments.build(:name => "Test", :label => ContentView::CONTENT_DIR,
|
||
:prior => @library)
|
||
refute env.save
|
||
assert_equal 1, env.errors.size
|
||
assert env.errors.has_key?(:label)
|
||
end
|
||
end
|
||
end
|
test/models/repository_test.rb | ||
---|---|---|
assert_equal "Empty_Organization-library_label-org_default_label-fedora_label-fedora_17_x86_64_label", repo_id
|
||
end
|
||
|
||
def test_clone_repo_path
|
||
path = Repository.clone_repo_path(:repository => @fedora_17_x86_64,
|
||
:version => @fedora_17_x86_64.content_view_version,
|
||
:content_view => @fedora_17_x86_64.content_view
|
||
)
|
||
assert_equal "/content_views/org_default_label/1/library/fedora_17_label", path
|
||
|
||
path = Repository.clone_repo_path(:repository => @fedora_17_x86_64,
|
||
:environment => @fedora_17_x86_64.organization.library,
|
||
:content_view => @fedora_17_x86_64.content_view
|
||
)
|
||
assert_equal "/library_default_view_library/library/fedora_17_label", path
|
||
end
|
||
|
||
def test_clone_repo_path_for_component
|
||
skip "TODO: Fix content views"
|
||
# validate that clone repo path for a component view does not include the component view label
|
Also available in: Unified diff
Content Views: Publishing version archives under content_views directory