Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
67 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,2 @@ | |||
--colour | |||
--format progress |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,33 @@ | |||
require 'spec_helper' | |||
|
|||
describe Psigner::Application do | |||
|
|||
describe "GET '/api/sign'" do | |||
it "should fail" do | |||
get '/' | |||
last_response.should_not be_ok | |||
end | |||
end | |||
|
|||
describe "POST '/api/sign'" do | |||
it "should fail to get the API signing page without parameters" do | |||
post '/api/sign' | |||
last_response.status.should == 400 | |||
end | |||
|
|||
it "should fail to get the API signing page with only one parameter" do | |||
post '/api/sign', params = { "secret" => "SHAREDSECRET" } | |||
last_response.status.should == 400 | |||
end | |||
|
|||
it "should get the API signing page" do | |||
post '/api/sign', params = { "secret" => "SHAREDSECRET", "certname" => "bob" } | |||
last_response.status.should == 200 | |||
end | |||
|
|||
it "should fail with incorrect shared secret" do | |||
post '/api/sign', params = { "secret" => "NOSHAREDSECRET", "certname" => "bob" } | |||
last_response.status.should == 401 | |||
end | |||
end | |||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,28 @@ | |||
$LOAD_PATH.unshift(File.dirname(__FILE__)) | |||
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) | |||
|
|||
require 'psigner' | |||
require 'rspec' | |||
require 'rack/test' | |||
|
|||
set :environment, :test | |||
set :run, false | |||
set :raise_errors, true | |||
set :logging, false | |||
|
|||
RSpec.configure do |config| | |||
config.include Rack::Test::Methods | |||
config.mock_framework = :mocha | |||
end | |||
|
|||
ENV['RACK_ENV'] = "test" | |||
|
|||
def app | |||
@app ||= Psigner::Application | |||
end | |||
|
|||
# quick convenience methods.. | |||
|
|||
def fixtures_path | |||
"#{File.dirname(File.expand_path(__FILE__))}/fixtures" | |||
end |