File: test_server.rb

package info (click to toggle)
ruby-fog-google 1.19.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,568 kB
  • sloc: ruby: 16,775; makefile: 3
file content (29 lines) | stat: -rw-r--r-- 721 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
require "helpers/test_helper"

class UnitTestServer < MiniTest::Test
  def setup
    Fog.mock!
    @client = Fog::Compute.new(provider: "google",
                               google_project: "foo")
  end

  def teardown
    Fog.unmock!
  end

  def test_if_server_accepts_ssh_keys
    key = "ssh-rsa IAMNOTAREALSSHKEYAMA== user@host.subdomain.example.com"

    File.stub :read, key do
      server = Fog::Compute::Google::Server.new(
        :name => "foo",
        :machine_type => "bar",
        :disks => ["baz"],
        :zone => "foo",
        :public_key_path => key
      )
      assert_equal(server.public_key, key,
                   "Fog::Compute::Google::Server loads public_key properly")
    end
  end
end