Skip to content

Commit

Permalink
Cleanup and some tests #4
Browse files Browse the repository at this point in the history
  • Loading branch information
oneiros committed Oct 18, 2022
1 parent 85c72dd commit c33651b
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 20 deletions.
20 changes: 0 additions & 20 deletions app/models/key_file.rb

This file was deleted.

5 changes: 5 additions & 0 deletions test/integration/required_authentication_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ class AuthenticationEnabledTest < ActionDispatch::IntegrationTest
environment_node_key_path("development", "testhost", "hdm::integer")
end

test "authentication requirements for files" do
authentication_required_for :get,
environment_key_files_path("multiple_hierarchies", "foobar::timezone")
end

test "authentication requirements for values" do
authentication_required_for :patch,
environment_node_key_hierarchy_data_file_value_path("development", "testhost", "hdm::integer", "Eyaml hierarchy", "common.yaml")
Expand Down
20 changes: 20 additions & 0 deletions test/models/hiera_data_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,24 @@ class HieraDataTest < ActiveSupport::TestCase

assert_equal expected_hash, hiera.lookup_options(node.facts)
end

test "#files_including returns file information for a given key" do
hiera = HieraData.new("multiple_hierarchies")
expected_result = [
{
path: "nodes/test.host.yaml",
hierarchy_name: "Host specific",
hierarchy_backend: :yaml,
value: "CET"
},
{
path: "common.yaml",
hierarchy_name: "Global data",
hierarchy_backend: :yaml,
value: "UTC"
}
]

assert_equal expected_result, hiera.files_including("foobar::timezone")
end
end

0 comments on commit c33651b

Please sign in to comment.