Sha256: 5ddd2455f70e009e59c20db9524c5f00a1b5b849e7862236b48e15d850d47102

Contents?: true

Size: 1.7 KB

Versions: 5

Compression:

Stored size: 1.7 KB

Contents

Shindo.tests('Fog::Compute[oraclecloud] | ssh_keys requests', 'ssh_keys') do

	tests("#sshkeys-create", "create") do
		sshkey = Fog::Compute[:oraclecloud].ssh_keys.create(
			:name 		=> 'TestSSHKey2',
			:enabled 	=> false,
			:key			=> 'ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEAkNNQ4ri2oUW46mBO/4CHMGCOALciumwGvFEMDLGNnlDbUSqU4IRrqgj+znLClfb29Oer0devdarM6DilsZVgZ2YbI5ZD5vICR/O9J0c28dArwbtFeIjcV2TCWyj5xKEXF1r+OrJMexHQa0fW1URGrU8QODpJNC/9eCVGcEXddL31xTZYpjoVOCVx66kNa6lSHEVV3T4zaCby9Oe5QI4gZe1+xyxHPNEW5wogwS3dlKSyL2CfBP0aUKOmJ5Nrl8+y0GqJQXdGjZ9FIknmwWueRW/6qPQvZocjOZ8YiPZgAP0RNy6lL+u8mnAazj/mrEdmB5QUzpDAllIr5Tn/xaddZQ=='
		)

		test "can create an sshkey" do
			sshkey.is_a? Fog::Compute::OracleCloud::SshKey
			sshkey.uri.is_a? String
		end

		check = Fog::Compute[:oraclecloud].ssh_keys.get(sshkey.name)
		test "can get ssh key" do
			check.uri == sshkey.uri
		end

		sshkey.enabled = true
		sshkey.save()
		test "can update ssh key" do
			check = Fog::Compute[:oraclecloud].ssh_keys.get(sshkey.name)
			check.enabled == true
		end
		
	end

	tests("#sshkeys-read") do
		sshkeys = Fog::Compute[:oraclecloud].ssh_keys
		test "returns an Array" do
			sshkeys.is_a? Array
		end
		test "should return keys" do
			sshkeys.size >= 1
		end
		test "should return a valid name" do
			sshkeys.first.name.is_a? String
		end

		sshkey = Fog::Compute[:oraclecloud].ssh_keys.get(sshkeys.first.name)
		test "should return a key" do
			sshkey.name.is_a? String
		end
	end

	tests("#sshkeys-delete", "create") do
		sshkey = Fog::Compute[:oraclecloud].ssh_keys.get('TestSSHKey2')
		sshkey.destroy()
		tests("should delete key").raises(Fog::Compute::OracleCloud::NotFound) do
			sshkey = Fog::Compute[:oraclecloud].ssh_keys.get('TestSSHKey2')
		end
	end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
fog-oraclecloud-0.1.17 tests/requests/ssh_keys_tests.rb
fog-oraclecloud-0.1.16 tests/requests/ssh_keys_tests.rb
fog-oraclecloud-0.1.15 tests/requests/ssh_keys_tests.rb
fog-oraclecloud-0.1.14 tests/requests/ssh_keys_tests.rb
fog-oraclecloud-0.1.13 tests/requests/ssh_keys_tests.rb