test/yao/resources/test_project.rb in yao-0.13.4 vs test/yao/resources/test_project.rb in yao-0.14.0
- old
+ new
@@ -252,6 +252,25 @@
}
project = Yao::Project.new(params)
assert_instance_of(Array, project.servers)
assert_requested(stub)
end
-end
\ No newline at end of file
+
+ def test_server_usage
+ stub = stub_request(:get, "https://example.com:12345/os-simple-tenant-usage/0123456789abcdef0123456789abcdef")
+ .to_return(
+ status: 200,
+ body: <<-JSON,
+ {
+ "tenant_usage": {
+ "total_memory_mb_usage": 1024
+ }
+ }
+ JSON
+ headers: {'Content-Type' => 'application/json'}
+ )
+
+ project = Yao::Project::new("id" => "0123456789abcdef0123456789abcdef")
+ usage = project.server_usage
+ assert_equal(1024, usage["total_memory_mb_usage"])
+ end
+end