Sha256: 39692c7e20e0a0523a75d900e3c74eeeef46768b8471e1c905f251f7e5e17460
Contents?: true
Size: 1.67 KB
Versions: 3
Compression:
Stored size: 1.67 KB
Contents
require 'test_plugin_helper' class SaltKeysTest < ActiveSupport::TestCase setup do User.current = User.find_by_login "admin" @proxy = OpenStruct.new(:id => 1, :url => 'http://dummy.example.com:9090') ProxyAPI::Salt.any_instance.stubs(:key_list).returns( { "saltstack.example.com" => {"state"=>"accepted", "fingerprint"=>"98:c2:63:c1:57:59:bc:bd:f1:ef:5a:38:b2:e9:71:c0"}, "saltclient01.example.com" => {"state"=>"unaccepted", "fingerprint"=>"98:c2:63:c1:57:59:bc:bd:f1:ef:5a:38:b2:e9:71:c1"}, "saltclient02.example.com" => {"state"=>"unaccepted", "fingerprint"=>"98:c2:63:c1:57:59:bc:bd:f1:ef:5a:38:b2:e9:71:c2"}, "saltclient03.example.com "=> {"state"=>"rejected", "fingerprint"=>"98:c2:63:c1:57:59:bc:bd:f1:ef:5a:38:b2:e9:71:c3"} } ) end test "key has a name" do assert_not_empty ForemanSalt::SmartProxies::SaltKeys.all(@proxy).first.name end test "key has a state" do assert_not_empty ForemanSalt::SmartProxies::SaltKeys.all(@proxy).first.state end test "key has a fingerprint" do assert_not_empty ForemanSalt::SmartProxies::SaltKeys.all(@proxy).first.fingerprint end test "key has a smart proxy id" do assert_equal 1, ForemanSalt::SmartProxies::SaltKeys.all(@proxy).first.smart_proxy_id end test "returns all keys" do assert_equal 4, ForemanSalt::SmartProxies::SaltKeys.all(@proxy).count end test "finds a key by name" do assert_equal ForemanSalt::SmartProxies::SaltKeys.find(@proxy, 'saltstack.example.com').name, 'saltstack.example.com' end test "find keys by state" do assert_equal 2, ForemanSalt::SmartProxies::SaltKeys.find_by_state(@proxy, 'unaccepted').count end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
foreman_salt-0.0.4 | test/unit/salt_keys_test.rb |
foreman_salt-0.0.3 | test/unit/salt_keys_test.rb |
foreman_salt-0.0.2 | test/unit/salt_keys_test.rb |