|
41 | 41 | expect(client.api_key).to eq 'fake_key' |
42 | 42 | end |
43 | 43 |
|
44 | | - it 'raises an error if passed an empty user name' do |
45 | | - expect do |
46 | | - $SL_API_USERNAME = '' |
47 | | - client = SoftLayer::Client.new(:api_key => 'fake_key', :endpoint_url => 'http://fakeurl.org/') |
48 | | - end.to raise_error |
49 | | - |
50 | | - expect do |
51 | | - $SL_API_USERNAME = 'good_username' |
52 | | - $SL_API_KEY = 'sample' |
53 | | - client = SoftLayer::Client.new(:username => '', :api_key => 'fake_key', :endpoint_url => 'http://fakeurl.org/') |
54 | | - end.to raise_error |
55 | | - end |
56 | | - |
57 | | - it 'fails if the user name is nil' do |
58 | | - expect do |
59 | | - $SL_API_USERNAME = nil |
60 | | - client = SoftLayer::Client.new(:username => nil, :api_key => 'fake_key', :endpoint_url => 'http://fakeurl.org/') |
61 | | - end.to raise_error |
62 | | - end |
63 | | - |
64 | | - it 'fails if the api_key is empty' do |
65 | | - expect do |
66 | | - $SL_API_KEY = '' |
67 | | - client = SoftLayer::Client.new(:username => 'fake_user', :endpoint_url => 'http://fakeurl.org/') |
68 | | - end.to raise_error |
69 | | - |
70 | | - expect do |
71 | | - client = SoftLayer::Client.new(:username => 'fake_user', :api_key => '', :endpoint_url => 'http://fakeurl.org/') |
72 | | - end.to raise_error |
73 | | - end |
74 | | - |
75 | | - it 'fails if the api_key is nil' do |
76 | | - expect do |
77 | | - $SL_API_KEY = nil |
78 | | - client = SoftLayer::Client.new(:username => 'fake_user', :endpoint_url => 'http://fakeurl.org/', :api_key => nil) |
79 | | - end.to raise_error |
| 44 | + it 'produces empty auth headers if the username is empty' do |
| 45 | + |
| 46 | + $SL_API_USERNAME = '' |
| 47 | + client = SoftLayer::Client.new(:api_key => 'fake_key', :endpoint_url => 'http://fakeurl.org/') |
| 48 | + |
| 49 | + expect(client.authentication_headers.empty?).to be true |
| 50 | + |
| 51 | + $SL_API_USERNAME = 'good_username' |
| 52 | + $SL_API_KEY = 'sample' |
| 53 | + client = SoftLayer::Client.new(:username => '', :api_key => 'fake_key', :endpoint_url => 'http://fakeurl.org/') |
| 54 | + |
| 55 | + expect(client.authentication_headers.empty?).to be true |
| 56 | + end |
| 57 | + |
| 58 | + it 'produces empty auth headers if the username is nil' do |
| 59 | + $SL_API_USERNAME = nil |
| 60 | + client = SoftLayer::Client.new(:username => nil, :api_key => 'fake_key', :endpoint_url => 'http://fakeurl.org/') |
| 61 | + |
| 62 | + expect(client.authentication_headers.empty?).to be true |
| 63 | + end |
| 64 | + |
| 65 | + it 'produces empty auth headers if the api_key is empty' do |
| 66 | + $SL_API_KEY = '' |
| 67 | + client = SoftLayer::Client.new(:username => 'fake_user', :endpoint_url => 'http://fakeurl.org/') |
| 68 | + |
| 69 | + expect(client.authentication_headers.empty?).to be true |
| 70 | + |
| 71 | + client = SoftLayer::Client.new(:username => 'fake_user', :api_key => '', :endpoint_url => 'http://fakeurl.org/') |
| 72 | + |
| 73 | + expect(client.authentication_headers.empty?).to be true |
| 74 | + end |
| 75 | + |
| 76 | + it 'produces empty auth headers if the api_key is nil' do |
| 77 | + $SL_API_KEY = nil |
| 78 | + client = SoftLayer::Client.new(:username => 'fake_user', :endpoint_url => 'http://fakeurl.org/', :api_key => nil) |
| 79 | + |
| 80 | + expect(client.authentication_headers.empty?).to be true |
80 | 81 | end |
81 | 82 |
|
82 | 83 | it 'initializes by default with nil as the timeout' do |
|
0 commit comments