test/yao/resources/test_keypair.rb in yao-0.7.0 vs test/yao/resources/test_keypair.rb in yao-0.8.0
- old
+ new
@@ -1,11 +1,7 @@
-class TestKeypair < Test::Unit::TestCase
+class TestKeypair < TestYaoResource
- def setup
- Yao.default_client.pool["compute"] = Yao::Client.gen_client("https://example.com:12345")
- end
-
def test_keypair
# https://docs.openstack.org/api-ref/compute/?expanded=list-keypairs-detail#list-keypairs
params = {
"fingerprint" => "7e:eb:ab:24:ba:d1:e1:88:ae:9a:fb:66:53:df:d3:bd",
"name" => "keypair-5d935425-31d5-48a7-a0f1-e76e9813f2c3",
@@ -22,11 +18,11 @@
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCkF3MX59OrlBs3dH5CU7lNmvpbrgZxSpyGjlnE8Flkirnc/Up22lpjznoxqeoTAwTW034k7Dz6aYIrZGmQwe2TkE084yqvlj45Dkyoj95fW/sZacm0cZNuL69EObEGHdprfGJQajrpz22NQoCD8TFB8Wv+8om9NH9Le6s+WPe98WC77KLw8qgfQsbIey+JawPWl4O67ZdL5xrypuRjfIPWjgy/VH85IXg/Z/GONZ2nxHgSShMkwqSFECAC5L3PHB+0+/12M/iikdatFSVGjpuHvkLOs3oe7m6HlOfluSJ85BzLWBbvva93qkGmLg4ZAc8rPh2O+YIsBUHNLLMM/oQp Generated-by-Nova
EOS
end
def test_list
- stub_request(:get, "https://example.com:12345/os-keypairs")
+ stub = stub_request(:get, "https://example.com:12345/os-keypairs")
.to_return(
status: 200,
body: <<-JSON,
{
"keypairs": [
@@ -48,7 +44,8 @@
headers: {'Content-Type' => 'application/json'}
)
keypairs = Yao::Keypair.list
assert_equal(keypairs.first.fingerprint, "7e:eb:ab:24:ba:d1:e1:88:ae:9a:fb:66:53:df:d3:bd")
+ assert_requested(stub)
end
end