Skip to content

Commit

Permalink
restore secrets_test to previous
Browse files Browse the repository at this point in the history
  • Loading branch information
suprjinx committed Sep 24, 2024
1 parent cf637a6 commit 0a6c26e
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions test/integration/secrets_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,39 +12,33 @@ class SecretsTest < ActionDispatch::IntegrationTest
end

test "#create or update a secret" do
create_secret("top/secret/key1")
create_secret
assert_response :success
%w[ data metadata lease_id ].each do |key|
assert_includes response.parsed_body["secret"].keys, key
end
end

test "#show" do
create_secret("top/secret/key2")
# pause
sleep(1)
create_secret
# view the secret
get secret_path("top/secret/key2"), headers: { "Authorization" => "Bearer #{jwt_authorized}" }
get secret_path("top/secret/key"), headers: { "Authorization" => "Bearer #{jwt_authorized}" }
assert_response :success
%w[ data metadata lease_id ].each do |key|
assert_includes response.parsed_body["secret"].keys, key
end
end

test "#delete" do
create_secret("top/secret/key3")
# pause
sleep(1)
create_secret
# delete the secret
delete destroy_secret_path("top/secret/key3"), headers: { "Authorization" => "Bearer #{jwt_authorized}" }
delete destroy_secret_path("top/secret/key"), headers: { "Authorization" => "Bearer #{jwt_authorized}" }
assert_response :success
end

private

def create_secret(path)
def create_secret
# create the secret
post secrets_path, headers: { "Authorization" => "Bearer #{jwt_authorized}" },
params: { secret: { path: path, data: { password: "sicr3t" } } }
params: { secret: { path: "top/secret/key", data: { password: "sicr3t" } } }
end
end

0 comments on commit 0a6c26e

Please sign in to comment.