2011-05-07 14:09:33 -04:00
|
|
|
Shindo.tests('AWS::IAM | server certificate requests', ['aws']) do
|
|
|
|
@key_name = 'fog-test'
|
|
|
|
|
2011-05-07 14:59:30 -04:00
|
|
|
@certificate_format = {
|
|
|
|
'Arn' => String,
|
|
|
|
'Path' => String,
|
|
|
|
'ServerCertificateId' => String,
|
|
|
|
'ServerCertificateName' => String,
|
|
|
|
'UploadDate' => Time
|
2011-07-06 14:34:43 -07:00
|
|
|
}
|
2011-05-07 14:09:33 -04:00
|
|
|
@upload_format = {
|
2011-05-07 14:59:30 -04:00
|
|
|
'Certificate' => @certificate_format,
|
2011-05-07 14:09:33 -04:00
|
|
|
'RequestId' => String
|
|
|
|
}
|
2011-07-06 14:34:43 -07:00
|
|
|
|
2011-07-20 16:04:31 -07:00
|
|
|
tests('#upload_server_certificate') do
|
2011-05-07 14:09:33 -04:00
|
|
|
public_key = AWS::IAM::SERVER_CERT_PUBLIC_KEY
|
|
|
|
private_key = AWS::IAM::SERVER_CERT_PRIVATE_KEY
|
2011-07-20 16:04:31 -07:00
|
|
|
|
|
|
|
tests('empty public key').raises(Fog::AWS::IAM::ValidationError) do
|
|
|
|
AWS[:iam].upload_server_certificate('', private_key, @key_name).body
|
|
|
|
end
|
|
|
|
|
|
|
|
tests('empty private key').raises(Fog::AWS::IAM::ValidationError) do
|
|
|
|
AWS[:iam].upload_server_certificate(public_key, '', @key_name).body
|
|
|
|
end
|
|
|
|
|
|
|
|
tests('format').formats(@upload_format) do
|
|
|
|
AWS[:iam].upload_server_certificate(public_key, private_key, @key_name).body
|
|
|
|
end
|
2011-05-07 14:09:33 -04:00
|
|
|
end
|
|
|
|
|
2011-07-18 17:04:40 -07:00
|
|
|
tests('#get_server_certificate').formats(@upload_format) do
|
|
|
|
tests('raises NotFound').raises(Fog::AWS::IAM::NotFound) do
|
|
|
|
AWS[:iam].get_server_certificate("#{@key_name}fake")
|
|
|
|
end
|
|
|
|
AWS[:iam].get_server_certificate(@key_name).body
|
|
|
|
end
|
|
|
|
|
2011-05-07 14:59:30 -04:00
|
|
|
@list_format = { 'Certificates' => [@certificate_format] }
|
|
|
|
tests('#list_server_certificates').formats(@list_format) do
|
|
|
|
result = AWS[:iam].list_server_certificates.body
|
|
|
|
tests('includes key name') do
|
|
|
|
returns(true) { result['Certificates'].any?{|c| c['ServerCertificateName'] == @key_name} }
|
|
|
|
end
|
|
|
|
result
|
|
|
|
end
|
|
|
|
|
2011-05-07 14:09:33 -04:00
|
|
|
tests('#delete_server_certificate').formats(AWS::IAM::Formats::BASIC) do
|
|
|
|
AWS[:iam].delete_server_certificate(@key_name).body
|
|
|
|
end
|
|
|
|
end
|