fog-proxmox 0.8.2 → 0.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2018 Tristan Robert
4
+
5
+ # This file is part of Fog::Proxmox.
6
+
7
+ # Fog::Proxmox is free software: you can redistribute it and/or modify
8
+ # it under the terms of the GNU General Public License as published by
9
+ # the Free Software Foundation, either version 3 of the License, or
10
+ # (at your option) any later version.
11
+
12
+ # Fog::Proxmox is distributed in the hope that it will be useful,
13
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ # GNU General Public License for more details.
16
+
17
+ # You should have received a copy of the GNU General Public License
18
+ # along with Fog::Proxmox. If not, see <http://www.gnu.org/licenses/>.
19
+
20
+ require 'spec_helper'
21
+ require 'fog/proxmox/hash'
22
+
23
+ describe Fog::Proxmox::Hash do
24
+ let(:net_vm) do
25
+ { net0: 'virtio=66:89:C5:59:AA:96,bridge=vmbr0,firewall=1,link_down=1,queues=1,rate=1,tag=1' }
26
+ end
27
+ let(:net) do
28
+ { id: 'net0', model: 'virtio', macaddr: '66:89:C5:59:AA:96', z: nil }
29
+ end
30
+
31
+ describe '#flatten' do
32
+ it 'returns string net_vm' do
33
+ assert_equal 'net0: virtio=66:89:C5:59:AA:96,bridge=vmbr0,firewall=1,link_down=1,queues=1,rate=1,tag=1', Fog::Proxmox::Hash.flatten(net_vm)
34
+ end
35
+ end
36
+
37
+ describe '#stringify' do
38
+ it 'returns stringify hash' do
39
+ assert_equal 'id=net0,model=virtio,macaddr=66:89:C5:59:AA:96', Fog::Proxmox::Hash.stringify(net)
40
+ end
41
+ end
42
+ end
@@ -31,7 +31,6 @@ describe Fog::Proxmox::Identity do
31
31
  @pve_url = @proxmox_vcr.url
32
32
  @username = @proxmox_vcr.username
33
33
  @password = @proxmox_vcr.password
34
- Fog::Proxmox.ticket_lifetime = 2 * 60 * 60 # default 2 hours
35
34
  end
36
35
 
37
36
  it 'checks ticket with path and privs' do
@@ -46,8 +45,7 @@ describe Fog::Proxmox::Identity do
46
45
  end
47
46
 
48
47
  it 'renew expired ticket' do
49
- VCR.use_cassette('auth') do
50
- Fog::Proxmox.ticket_lifetime = 0 # ticket expired
48
+ VCR.use_cassette('renew') do
51
49
  @connection_options = {}
52
50
  # ignore enterprise proxy
53
51
  @connection_options[:disable_proxy] = true if ENV['DISABLE_PROXY'] == 'true'
@@ -57,12 +55,12 @@ describe Fog::Proxmox::Identity do
57
55
  pve_url: @pve_url,
58
56
  pve_username: @username,
59
57
  pve_password: @password,
58
+ pve_ticket_lifetime: - (100 * 60 * 60), # ticket has expired from 100 hours
60
59
  connection_options: @connection_options
61
60
  }
62
- _(Fog::Proxmox.credentials_has_expired?).must_equal true
63
- Fog::Proxmox.authenticate(connection_params)
64
- Fog::Proxmox.ticket_lifetime = 2 * 60 * 60
65
61
  _(Fog::Proxmox.credentials_has_expired?).must_equal false
62
+ Fog::Proxmox.authenticate(connection_params)
63
+ _(Fog::Proxmox.credentials_has_expired?).must_equal true
66
64
  end
67
65
  end
68
66
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fog-proxmox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 0.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tristan Robert
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-28 00:00:00.000000000 Z
11
+ date: 2019-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -474,6 +474,7 @@ files:
474
474
  - spec/fixtures/proxmox/identity/permissions.yml
475
475
  - spec/fixtures/proxmox/identity/pools.yml
476
476
  - spec/fixtures/proxmox/identity/read_version.yml
477
+ - spec/fixtures/proxmox/identity/renew.yml
477
478
  - spec/fixtures/proxmox/identity/roles.yml
478
479
  - spec/fixtures/proxmox/identity/users.yml
479
480
  - spec/fixtures/proxmox/network/identity_ticket.yml
@@ -527,6 +528,7 @@ test_files:
527
528
  - spec/fixtures/proxmox/identity/permissions.yml
528
529
  - spec/fixtures/proxmox/identity/pools.yml
529
530
  - spec/fixtures/proxmox/identity/read_version.yml
531
+ - spec/fixtures/proxmox/identity/renew.yml
530
532
  - spec/fixtures/proxmox/identity/roles.yml
531
533
  - spec/fixtures/proxmox/identity/users.yml
532
534
  - spec/fixtures/proxmox/network/identity_ticket.yml