tests/aws/requests/iam/server_certificate_tests.rb in fog-0.11.0 vs tests/aws/requests/iam/server_certificate_tests.rb in fog-1.0.0
- old
+ new
@@ -17,53 +17,61 @@
public_key = AWS::IAM::SERVER_CERT_PUBLIC_KEY
private_key = AWS::IAM::SERVER_CERT_PRIVATE_KEY
private_key_mismatch = AWS::IAM::SERVER_CERT_PRIVATE_KEY_MISMATCHED
tests('empty public key').raises(Fog::AWS::IAM::ValidationError) do
- AWS[:iam].upload_server_certificate('', private_key, @key_name)
+ Fog::AWS::IAM.new.upload_server_certificate('', private_key, @key_name)
end
tests('empty private key').raises(Fog::AWS::IAM::ValidationError) do
- AWS[:iam].upload_server_certificate(public_key, '', @key_name)
+ Fog::AWS::IAM.new.upload_server_certificate(public_key, '', @key_name)
end
tests('invalid public key').raises(Fog::AWS::IAM::MalformedCertificate) do
- AWS[:iam].upload_server_certificate('abcde', private_key, @key_name)
+ Fog::AWS::IAM.new.upload_server_certificate('abcde', private_key, @key_name)
end
tests('invalid private key').raises(Fog::AWS::IAM::MalformedCertificate) do
- AWS[:iam].upload_server_certificate(public_key, 'abcde', @key_name)
+ Fog::AWS::IAM.new.upload_server_certificate(public_key, 'abcde', @key_name)
end
tests('mismatched private key').raises(Fog::AWS::IAM::KeyPairMismatch) do
- AWS[:iam].upload_server_certificate(public_key, private_key_mismatch, @key_name)
+ Fog::AWS::IAM.new.upload_server_certificate(public_key, private_key_mismatch, @key_name)
end
tests('format').formats(@upload_format) do
- AWS[:iam].upload_server_certificate(public_key, private_key, @key_name).body
+ Fog::AWS::IAM.new.upload_server_certificate(public_key, private_key, @key_name).body
end
tests('duplicate name').raises(Fog::AWS::IAM::EntityAlreadyExists) do
- AWS[:iam].upload_server_certificate(public_key, private_key, @key_name)
+ Fog::AWS::IAM.new.upload_server_certificate(public_key, private_key, @key_name)
end
end
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")
+ Fog::AWS::IAM.new.get_server_certificate("#{@key_name}fake")
end
- AWS[:iam].get_server_certificate(@key_name).body
+ Fog::AWS::IAM.new.get_server_certificate(@key_name).body
end
@list_format = { 'Certificates' => [@certificate_format] }
tests('#list_server_certificates').formats(@list_format) do
- result = AWS[:iam].list_server_certificates.body
+ result = Fog::AWS::IAM.new.list_server_certificates.body
tests('includes key name') do
returns(true) { result['Certificates'].any?{|c| c['ServerCertificateName'] == @key_name} }
end
result
end
+ tests("#list_server_certificates('path-prefix' => '/'").formats(@list_format) do
+ result = Fog::AWS::IAM.new.list_server_certificates('PathPrefix' => '/').body
+ tests('includes key name') do
+ returns(true) { result['Certificates'].any?{|c| c['ServerCertificateName'] == @key_name} }
+ end
+ result
+ end
+
tests('#delete_server_certificate').formats(AWS::IAM::Formats::BASIC) do
- AWS[:iam].delete_server_certificate(@key_name).body
+ Fog::AWS::IAM.new.delete_server_certificate(@key_name).body
end
end