Skip to content

Commit

Permalink
add test for secret_request
Browse files Browse the repository at this point in the history
  • Loading branch information
suprjinx committed Sep 19, 2024
1 parent 9192a7e commit 6cd0b82
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions test/lib/requests/secret_request_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# test/models/cert_issue_request_test.rb
require "test_helper"

class SecretRequestTest < ActiveSupport::TestCase
def setup
@attributes = {
path: "my/top/secret",
data: {
"password": "t0p-s3cret"
}
}
@secret_request = Requests::SecretRequest.new(@attributes)
end

test "#new should set attributes from attributes argument" do
@attributes.each do |key, value|
assert_equal value, @secret_request.send(key), "Attribute #{key} was not set correctly"
end
end

test "#valid? should be valid with valid attributes" do
assert @secret_request.valid?
end

test "#valid? should require a path" do
@secret_request.path = nil
assert_not @secret_request.valid?
assert_includes @secret_request.errors[:path], "can't be blank"
end

test "#kv_path should be an alias for #path" do
assert @attributes[:path], @secret_request.kv_path
end
end

0 comments on commit 6cd0b82

Please sign in to comment.