fog-packet 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +51 -0
- data/.rubocop.yml +38 -0
- data/Gemfile +4 -0
- data/LICENSE +21 -0
- data/README.md +1176 -0
- data/Rakefile +24 -0
- data/fog-packet.gemspec +24 -0
- data/lib/fog-packet.rb +26 -0
- data/lib/fog/compute/packet/compute.rb +313 -0
- data/lib/fog/compute/packet/models/bandwidth.rb +14 -0
- data/lib/fog/compute/packet/models/batch.rb +18 -0
- data/lib/fog/compute/packet/models/batches.rb +27 -0
- data/lib/fog/compute/packet/models/bgp_session.rb +35 -0
- data/lib/fog/compute/packet/models/bgp_sessions.rb +22 -0
- data/lib/fog/compute/packet/models/capacities.rb +27 -0
- data/lib/fog/compute/packet/models/capacity.rb +29 -0
- data/lib/fog/compute/packet/models/device.rb +136 -0
- data/lib/fog/compute/packet/models/devices.rb +22 -0
- data/lib/fog/compute/packet/models/email.rb +50 -0
- data/lib/fog/compute/packet/models/email_verification.rb +18 -0
- data/lib/fog/compute/packet/models/emails.rb +17 -0
- data/lib/fog/compute/packet/models/event.rb +23 -0
- data/lib/fog/compute/packet/models/events.rb +17 -0
- data/lib/fog/compute/packet/models/facilities.rb +17 -0
- data/lib/fog/compute/packet/models/facility.rb +22 -0
- data/lib/fog/compute/packet/models/hardware_reservation.rb +66 -0
- data/lib/fog/compute/packet/models/hardware_reservations.rb +22 -0
- data/lib/fog/compute/packet/models/invitation.rb +36 -0
- data/lib/fog/compute/packet/models/invitations.rb +22 -0
- data/lib/fog/compute/packet/models/ip.rb +60 -0
- data/lib/fog/compute/packet/models/ips.rb +22 -0
- data/lib/fog/compute/packet/models/license.rb +55 -0
- data/lib/fog/compute/packet/models/licenses.rb +22 -0
- data/lib/fog/compute/packet/models/membership.rb +38 -0
- data/lib/fog/compute/packet/models/memberships.rb +22 -0
- data/lib/fog/compute/packet/models/notification.rb +31 -0
- data/lib/fog/compute/packet/models/notifications.rb +22 -0
- data/lib/fog/compute/packet/models/operating_system.rb +23 -0
- data/lib/fog/compute/packet/models/operating_systems.rb +17 -0
- data/lib/fog/compute/packet/models/organization.rb +71 -0
- data/lib/fog/compute/packet/models/organizations.rb +22 -0
- data/lib/fog/compute/packet/models/payment_method.rb +63 -0
- data/lib/fog/compute/packet/models/payment_methods.rb +22 -0
- data/lib/fog/compute/packet/models/plan.rb +23 -0
- data/lib/fog/compute/packet/models/plans.rb +17 -0
- data/lib/fog/compute/packet/models/project.rb +47 -0
- data/lib/fog/compute/packet/models/projects.rb +22 -0
- data/lib/fog/compute/packet/models/session.rb +22 -0
- data/lib/fog/compute/packet/models/sessions.rb +26 -0
- data/lib/fog/compute/packet/models/snapshot.rb +33 -0
- data/lib/fog/compute/packet/models/snapshots.rb +22 -0
- data/lib/fog/compute/packet/models/spot_market_price.rb +15 -0
- data/lib/fog/compute/packet/models/spot_market_prices.rb +22 -0
- data/lib/fog/compute/packet/models/ssh_key.rb +51 -0
- data/lib/fog/compute/packet/models/ssh_keys.rb +22 -0
- data/lib/fog/compute/packet/models/transfer_request.rb +34 -0
- data/lib/fog/compute/packet/models/transfer_requests.rb +27 -0
- data/lib/fog/compute/packet/models/two_factor_auth.rb +18 -0
- data/lib/fog/compute/packet/models/user.rb +56 -0
- data/lib/fog/compute/packet/models/users.rb +22 -0
- data/lib/fog/compute/packet/models/virtual_network.rb +76 -0
- data/lib/fog/compute/packet/models/virtual_networks.rb +17 -0
- data/lib/fog/compute/packet/models/volume.rb +96 -0
- data/lib/fog/compute/packet/models/volumes.rb +23 -0
- data/lib/fog/compute/packet/models/vpn.rb +16 -0
- data/lib/fog/compute/packet/models/vpns.rb +27 -0
- data/lib/fog/compute/packet/requests/accept_invitation.rb +43 -0
- data/lib/fog/compute/packet/requests/accept_transfer_request.rb +26 -0
- data/lib/fog/compute/packet/requests/assign_ip.rb +32 -0
- data/lib/fog/compute/packet/requests/assign_port.rb +25 -0
- data/lib/fog/compute/packet/requests/attach_volume.rb +41 -0
- data/lib/fog/compute/packet/requests/bond_ports.rb +25 -0
- data/lib/fog/compute/packet/requests/create_batch.rb +43 -0
- data/lib/fog/compute/packet/requests/create_bgp_session.rb +37 -0
- data/lib/fog/compute/packet/requests/create_device.rb +212 -0
- data/lib/fog/compute/packet/requests/create_email.rb +38 -0
- data/lib/fog/compute/packet/requests/create_license.rb +46 -0
- data/lib/fog/compute/packet/requests/create_organization.rb +87 -0
- data/lib/fog/compute/packet/requests/create_payment_method.rb +63 -0
- data/lib/fog/compute/packet/requests/create_project.rb +72 -0
- data/lib/fog/compute/packet/requests/create_snapshot.rb +25 -0
- data/lib/fog/compute/packet/requests/create_ssh_key.rb +44 -0
- data/lib/fog/compute/packet/requests/create_virtual_network.rb +49 -0
- data/lib/fog/compute/packet/requests/create_volume.rb +70 -0
- data/lib/fog/compute/packet/requests/decline_invitation.rb +43 -0
- data/lib/fog/compute/packet/requests/decline_transfer_request.rb +26 -0
- data/lib/fog/compute/packet/requests/delete_bgp_session.rb +25 -0
- data/lib/fog/compute/packet/requests/delete_device.rb +25 -0
- data/lib/fog/compute/packet/requests/delete_email.rb +25 -0
- data/lib/fog/compute/packet/requests/delete_license.rb +25 -0
- data/lib/fog/compute/packet/requests/delete_membership.rb +25 -0
- data/lib/fog/compute/packet/requests/delete_organization.rb +25 -0
- data/lib/fog/compute/packet/requests/delete_payment_method.rb +25 -0
- data/lib/fog/compute/packet/requests/delete_project.rb +25 -0
- data/lib/fog/compute/packet/requests/delete_session.rb +27 -0
- data/lib/fog/compute/packet/requests/delete_snapshot.rb +25 -0
- data/lib/fog/compute/packet/requests/delete_ssh_key.rb +25 -0
- data/lib/fog/compute/packet/requests/delete_virtual_network.rb +25 -0
- data/lib/fog/compute/packet/requests/delete_volume.rb +25 -0
- data/lib/fog/compute/packet/requests/detach_volume.rb +36 -0
- data/lib/fog/compute/packet/requests/disable_two_factor_auth.rb +27 -0
- data/lib/fog/compute/packet/requests/disable_vpn.rb +25 -0
- data/lib/fog/compute/packet/requests/disbond_ports.rb +25 -0
- data/lib/fog/compute/packet/requests/enable_two_factor_auth.rb +26 -0
- data/lib/fog/compute/packet/requests/enable_vpn.rb +25 -0
- data/lib/fog/compute/packet/requests/get_bandwidth.rb +31 -0
- data/lib/fog/compute/packet/requests/get_batch.rb +38 -0
- data/lib/fog/compute/packet/requests/get_bgp_session.rb +37 -0
- data/lib/fog/compute/packet/requests/get_capacity.rb +165 -0
- data/lib/fog/compute/packet/requests/get_device.rb +189 -0
- data/lib/fog/compute/packet/requests/get_email.rb +32 -0
- data/lib/fog/compute/packet/requests/get_hardware_reservation.rb +193 -0
- data/lib/fog/compute/packet/requests/get_invitation.rb +43 -0
- data/lib/fog/compute/packet/requests/get_ip.rb +60 -0
- data/lib/fog/compute/packet/requests/get_license.rb +37 -0
- data/lib/fog/compute/packet/requests/get_membership.rb +40 -0
- data/lib/fog/compute/packet/requests/get_notification.rb +40 -0
- data/lib/fog/compute/packet/requests/get_organization.rb +61 -0
- data/lib/fog/compute/packet/requests/get_payment_method.rb +56 -0
- data/lib/fog/compute/packet/requests/get_project.rb +67 -0
- data/lib/fog/compute/packet/requests/get_ssh_key.rb +38 -0
- data/lib/fog/compute/packet/requests/get_transfer_request.rb +38 -0
- data/lib/fog/compute/packet/requests/get_user.rb +56 -0
- data/lib/fog/compute/packet/requests/get_volume.rb +60 -0
- data/lib/fog/compute/packet/requests/get_vpn.rb +29 -0
- data/lib/fog/compute/packet/requests/list_batches.rb +33 -0
- data/lib/fog/compute/packet/requests/list_bgp_sessions.rb +32 -0
- data/lib/fog/compute/packet/requests/list_devices.rb +33 -0
- data/lib/fog/compute/packet/requests/list_events.rb +33 -0
- data/lib/fog/compute/packet/requests/list_facilities.rb +57 -0
- data/lib/fog/compute/packet/requests/list_hardware_reservations.rb +216 -0
- data/lib/fog/compute/packet/requests/list_invitations.rb +48 -0
- data/lib/fog/compute/packet/requests/list_ips.rb +65 -0
- data/lib/fog/compute/packet/requests/list_licenses.rb +42 -0
- data/lib/fog/compute/packet/requests/list_memberships.rb +45 -0
- data/lib/fog/compute/packet/requests/list_notifications.rb +45 -0
- data/lib/fog/compute/packet/requests/list_operating_systems.rb +66 -0
- data/lib/fog/compute/packet/requests/list_organizations.rb +81 -0
- data/lib/fog/compute/packet/requests/list_payment_methods.rb +76 -0
- data/lib/fog/compute/packet/requests/list_plans.rb +92 -0
- data/lib/fog/compute/packet/requests/list_projects.rb +87 -0
- data/lib/fog/compute/packet/requests/list_sessions.rb +40 -0
- data/lib/fog/compute/packet/requests/list_snapshots.rb +40 -0
- data/lib/fog/compute/packet/requests/list_spotmarketprices.rb +173 -0
- data/lib/fog/compute/packet/requests/list_spotmarketprices_history.rb +42 -0
- data/lib/fog/compute/packet/requests/list_ssh_keys.rb +50 -0
- data/lib/fog/compute/packet/requests/list_transfer_requests.rb +43 -0
- data/lib/fog/compute/packet/requests/list_users.rb +61 -0
- data/lib/fog/compute/packet/requests/list_virtual_networks.rb +62 -0
- data/lib/fog/compute/packet/requests/list_volumes.rb +65 -0
- data/lib/fog/compute/packet/requests/move_hardware_reservation.rb +43 -0
- data/lib/fog/compute/packet/requests/poweroff_device.rb +194 -0
- data/lib/fog/compute/packet/requests/poweron_device.rb +194 -0
- data/lib/fog/compute/packet/requests/reboot_device.rb +194 -0
- data/lib/fog/compute/packet/requests/request_email_verification.rb +25 -0
- data/lib/fog/compute/packet/requests/reserve_ip.rb +37 -0
- data/lib/fog/compute/packet/requests/session_login.rb +25 -0
- data/lib/fog/compute/packet/requests/transfer_project.rb +43 -0
- data/lib/fog/compute/packet/requests/unassign_ip.rb +24 -0
- data/lib/fog/compute/packet/requests/unassign_port.rb +25 -0
- data/lib/fog/compute/packet/requests/update_device.rb +201 -0
- data/lib/fog/compute/packet/requests/update_email.rb +37 -0
- data/lib/fog/compute/packet/requests/update_license.rb +42 -0
- data/lib/fog/compute/packet/requests/update_membership.rb +43 -0
- data/lib/fog/compute/packet/requests/update_notification.rb +40 -0
- data/lib/fog/compute/packet/requests/update_organization.rb +85 -0
- data/lib/fog/compute/packet/requests/update_payment_method.rb +63 -0
- data/lib/fog/compute/packet/requests/update_project.rb +71 -0
- data/lib/fog/compute/packet/requests/update_ssh_key.rb +43 -0
- data/lib/fog/compute/packet/requests/update_user.rb +65 -0
- data/lib/fog/compute/packet/requests/update_volume.rb +66 -0
- data/lib/fog/compute/packet/requests/validate_capacity.rb +38 -0
- data/lib/fog/compute/packet/requests/verify_email.rb +36 -0
- data/tests/packet/models/test_batches.rb +45 -0
- data/tests/packet/models/test_bgp_sessions.rb +52 -0
- data/tests/packet/models/test_capacity.rb +40 -0
- data/tests/packet/models/test_devices.rb +93 -0
- data/tests/packet/models/test_email_verification.rb +25 -0
- data/tests/packet/models/test_emails.rb +45 -0
- data/tests/packet/models/test_facilities.rb +18 -0
- data/tests/packet/models/test_hardware_reservations.rb +38 -0
- data/tests/packet/models/test_invitations.rb +41 -0
- data/tests/packet/models/test_ips.rb +52 -0
- data/tests/packet/models/test_licenses.rb +56 -0
- data/tests/packet/models/test_memberships.rb +41 -0
- data/tests/packet/models/test_notifications.rb +35 -0
- data/tests/packet/models/test_operating_systems.rb +19 -0
- data/tests/packet/models/test_organizations.rb +67 -0
- data/tests/packet/models/test_payment_methods.rb +61 -0
- data/tests/packet/models/test_plans.rb +19 -0
- data/tests/packet/models/test_projects.rb +41 -0
- data/tests/packet/models/test_sessions.rb +34 -0
- data/tests/packet/models/test_snapshots.rb +43 -0
- data/tests/packet/models/test_spotmarketprices.rb +28 -0
- data/tests/packet/models/test_ssh_keys.rb +58 -0
- data/tests/packet/models/test_transfer_requests.rb +49 -0
- data/tests/packet/models/test_two_factor_auth.rb +29 -0
- data/tests/packet/models/test_users.rb +47 -0
- data/tests/packet/models/test_virtual_networks.rb +81 -0
- data/tests/packet/models/test_volumes.rb +70 -0
- data/tests/packet/models/test_vpns.rb +37 -0
- data/tests/packet/requests/test_batches.rb +45 -0
- data/tests/packet/requests/test_bgp_sessions.rb +64 -0
- data/tests/packet/requests/test_capacity.rb +40 -0
- data/tests/packet/requests/test_devices.rb +104 -0
- data/tests/packet/requests/test_email_verification.rb +25 -0
- data/tests/packet/requests/test_emails.rb +51 -0
- data/tests/packet/requests/test_facilities.rb +19 -0
- data/tests/packet/requests/test_hardware_reservations.rb +38 -0
- data/tests/packet/requests/test_invitations.rb +40 -0
- data/tests/packet/requests/test_ips.rb +66 -0
- data/tests/packet/requests/test_licenses.rb +56 -0
- data/tests/packet/requests/test_memberships.rb +43 -0
- data/tests/packet/requests/test_notifications.rb +40 -0
- data/tests/packet/requests/test_operating_systems.rb +19 -0
- data/tests/packet/requests/test_organizations.rb +64 -0
- data/tests/packet/requests/test_payment_methods.rb +60 -0
- data/tests/packet/requests/test_plans.rb +21 -0
- data/tests/packet/requests/test_projects.rb +40 -0
- data/tests/packet/requests/test_sessions.rb +34 -0
- data/tests/packet/requests/test_snapshots.rb +57 -0
- data/tests/packet/requests/test_sportmarketprices.rb +29 -0
- data/tests/packet/requests/test_ssh_keys.rb +60 -0
- data/tests/packet/requests/test_transfer_requests.rb +46 -0
- data/tests/packet/requests/test_two_factor_auth.rb +29 -0
- data/tests/packet/requests/test_users.rb +48 -0
- data/tests/packet/requests/test_virtual_networks.rb +100 -0
- data/tests/packet/requests/test_volumes.rb +95 -0
- data/tests/packet/requests/test_vpns.rb +38 -0
- data/tests/test_helper.rb +4 -0
- metadata +345 -0
@@ -0,0 +1,18 @@
|
|
1
|
+
require_relative "../../test_helper.rb"
|
2
|
+
|
3
|
+
# TestFacilities
|
4
|
+
class TestFacilities < Minitest::Test
|
5
|
+
def self.test_order
|
6
|
+
:alpha
|
7
|
+
end
|
8
|
+
|
9
|
+
def setup
|
10
|
+
# Establish Connection
|
11
|
+
@compute = Fog::Compute::Packet.new(:packet_token => ENV["PACKET_TOKEN"])
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_list_facilities
|
15
|
+
facilities = @compute.facilities.all
|
16
|
+
assert !facilities.empty?
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require_relative "../../test_helper.rb"
|
2
|
+
|
3
|
+
# TestHardwareReservations
|
4
|
+
class TestHardwareReservations < Minitest::Test
|
5
|
+
def self.test_order
|
6
|
+
:alpha
|
7
|
+
end
|
8
|
+
|
9
|
+
def setup
|
10
|
+
# Establish Connection
|
11
|
+
@compute = Fog::Compute::Packet.new(:packet_token => ENV["PACKET_TOKEN"])
|
12
|
+
@project_id = "93125c2a-8b78-4d4f-a3c4-7367d6b7cca8"
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_request_a_list_hardware_reservations
|
16
|
+
# Perform Request
|
17
|
+
response = @compute.hardware_reservations.all(@project_id)
|
18
|
+
|
19
|
+
# Assertions
|
20
|
+
assert !response.empty?
|
21
|
+
|
22
|
+
@@reservation_id = response[0].id
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_request_b_get_hardware_reservation
|
26
|
+
response = @compute.hardware_reservations.get(@@reservation_id)
|
27
|
+
|
28
|
+
assert response
|
29
|
+
assert_equal @@reservation_id, response.id
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_request_c_move_hardware_reservation
|
33
|
+
reservation = @compute.hardware_reservations.get(@@reservation_id)
|
34
|
+
|
35
|
+
response = reservation.move(@project_id)
|
36
|
+
assert_equal true, response
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require_relative "../../test_helper.rb"
|
2
|
+
|
3
|
+
# TestInvitations
|
4
|
+
class TestInvitations < Minitest::Test
|
5
|
+
def self.test_order
|
6
|
+
:alpha
|
7
|
+
end
|
8
|
+
|
9
|
+
def setup
|
10
|
+
@compute = Fog::Compute::Packet.new(:packet_token => ENV["PACKET_TOKEN"])
|
11
|
+
|
12
|
+
@project_id = "93125c2a-8b78-4d4f-a3c4-7367d6b7cca8"
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_a_list_invitations
|
16
|
+
response = @compute.invitations.all(@project_id)
|
17
|
+
|
18
|
+
assert !response.empty?
|
19
|
+
@@invite_id = response[0].id
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_b_get_invitation
|
23
|
+
response = @compute.invitations.get(@@invite_id)
|
24
|
+
|
25
|
+
assert response
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_c_accept_invitation
|
29
|
+
invite = @compute.invitations.get(@@invite_id)
|
30
|
+
|
31
|
+
response = invite.accept
|
32
|
+
assert response
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_d_decline_invitation
|
36
|
+
invite = @compute.invitations.get(@@invite_id)
|
37
|
+
|
38
|
+
response = invite.decline
|
39
|
+
assert response
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require_relative "../../test_helper.rb"
|
2
|
+
|
3
|
+
# TestIps
|
4
|
+
class TestIps < Minitest::Test
|
5
|
+
def self.test_order
|
6
|
+
:alpha
|
7
|
+
end
|
8
|
+
|
9
|
+
def setup
|
10
|
+
@compute = Fog::Compute::Packet.new(:packet_token => ENV["PACKET_TOKEN"])
|
11
|
+
@project_id = "93125c2a-8b78-4d4f-a3c4-7367d6b7cca8"
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_a_reserve_ip
|
15
|
+
device = @compute.devices.create(:project_id => @project_id, :facility => "ewr1", :plan => "baremetal_0", :hostname => "test01", :operating_system => "coreos_stable")
|
16
|
+
|
17
|
+
device.wait_for { ready? }
|
18
|
+
|
19
|
+
@@device_id = device.id
|
20
|
+
|
21
|
+
response = @compute.ips.create(:project_id => @project_id, :facility => "ewr1", :quantity => 2, :type => "global_ipv4", :comments => "test comment")
|
22
|
+
|
23
|
+
@@address = response.address
|
24
|
+
@@ip_id = response.id
|
25
|
+
|
26
|
+
# assert_equal 201, response.status
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_b_list_ips
|
30
|
+
response = @compute.ips.all(@project_id)
|
31
|
+
assert !response.empty?
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_c_get_ip
|
35
|
+
response = @compute.ips.get(@@ip_id)
|
36
|
+
assert_equal @@ip_id, response.id
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_d_assign
|
40
|
+
ip = @compute.ips.get(@@ip_id)
|
41
|
+
response = ip.assign(@@device_id)
|
42
|
+
|
43
|
+
assert response
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_e_unassign_ip
|
47
|
+
ip = @compute.ips.get(@@ip_id)
|
48
|
+
response = ip.unassign
|
49
|
+
|
50
|
+
assert_equal true, response
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require_relative "../../test_helper.rb"
|
2
|
+
|
3
|
+
# TestLicenses
|
4
|
+
class TestLicenses < Minitest::Test
|
5
|
+
def self.test_order
|
6
|
+
:alpha
|
7
|
+
end
|
8
|
+
|
9
|
+
def setup
|
10
|
+
@compute = Fog::Compute::Packet.new(:packet_token => ENV["PACKET_TOKEN"])
|
11
|
+
|
12
|
+
@project_id = "93125c2a-8b78-4d4f-a3c4-7367d6b7cca8"
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_a_create_license
|
16
|
+
license = {
|
17
|
+
:project_id => @project_id,
|
18
|
+
:description => "test01",
|
19
|
+
:size => "1",
|
20
|
+
:license_product_id => "blah"
|
21
|
+
}
|
22
|
+
|
23
|
+
license = @compute.licenses.create(license)
|
24
|
+
|
25
|
+
assert license
|
26
|
+
@@license_id = license.id
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_b_list_licenses
|
30
|
+
response = @compute.licenses.all(@project_id)
|
31
|
+
|
32
|
+
assert !response.empty?
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_c_get_license
|
36
|
+
response = @compute.licenses.get(@@license_id)
|
37
|
+
|
38
|
+
assert_equal @@license_id, response.id
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_d_update_license
|
42
|
+
license = @compute.licenses.get(@@license_id)
|
43
|
+
license.description = "test02"
|
44
|
+
|
45
|
+
updated = license.update
|
46
|
+
|
47
|
+
assert_equal "test02", updated.description
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_e_delete_license
|
51
|
+
license = @compute.licenses.get(@@license_id)
|
52
|
+
|
53
|
+
response = license.destroy
|
54
|
+
assert_equal true, response
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require_relative "../../test_helper.rb"
|
2
|
+
|
3
|
+
# TestMemberships
|
4
|
+
class TestMemberships < Minitest::Test
|
5
|
+
def self.test_order
|
6
|
+
:alpha
|
7
|
+
end
|
8
|
+
|
9
|
+
def setup
|
10
|
+
@compute = Fog::Compute::Packet.new(:packet_token => ENV["PACKET_TOKEN"])
|
11
|
+
@project_id = "93125c2a-8b78-4d4f-a3c4-7367d6b7cca8"
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_a_list_memberships
|
15
|
+
response = @compute.memberships.all(@project_id)
|
16
|
+
|
17
|
+
assert !response.empty?
|
18
|
+
@@membership_id = response[0].id
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_b_get_membership
|
22
|
+
response = @compute.memberships.get(@@membership_id)
|
23
|
+
|
24
|
+
assert_equal @@membership_id, response.id
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_c_update_membership
|
28
|
+
membership = @compute.memberships.get(@@membership_id)
|
29
|
+
|
30
|
+
membership.roles = ["test02"]
|
31
|
+
response = membership.update
|
32
|
+
assert_equal @@membership_id, response.id
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_d_delete_membership
|
36
|
+
membership = @compute.memberships.get(@@membership_id)
|
37
|
+
response = membership.destroy
|
38
|
+
|
39
|
+
assert_equal true, response
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require_relative "../../test_helper.rb"
|
2
|
+
|
3
|
+
# TestProjects
|
4
|
+
class TestProjects < Minitest::Test
|
5
|
+
def setup
|
6
|
+
# Establish Connection
|
7
|
+
@compute = Fog::Compute::Packet.new(:packet_token => ENV["PACKET_TOKEN"])
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_a_list_notifications
|
11
|
+
# Perform Request
|
12
|
+
response = @compute.notifications.all
|
13
|
+
|
14
|
+
# Assertions
|
15
|
+
assert !response.empty?
|
16
|
+
|
17
|
+
@@notification_id = response[0].id
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_b_get_notification
|
21
|
+
# Perform Request
|
22
|
+
response = @compute.notifications.get(@@notification_id)
|
23
|
+
|
24
|
+
# Assertions
|
25
|
+
assert_equal @@notification_id, response.id
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_c_update_notification
|
29
|
+
notification = @compute.notifications.get(@@notification_id)
|
30
|
+
|
31
|
+
response = notification.update
|
32
|
+
assert_equal @@notification_id, response.id
|
33
|
+
assert_equal true, response.read
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require_relative "../../test_helper.rb"
|
2
|
+
|
3
|
+
# TestOperatingSystems
|
4
|
+
class TestOperatingSystems < Minitest::Test
|
5
|
+
def self.test_order
|
6
|
+
:alpha
|
7
|
+
end
|
8
|
+
|
9
|
+
def setup
|
10
|
+
# Establish Connection
|
11
|
+
@compute = Fog::Compute::Packet.new(:packet_token => ENV["PACKET_TOKEN"])
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_list_facilities
|
15
|
+
response = @compute.operating_systems.all
|
16
|
+
|
17
|
+
assert !response.empty?
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require_relative "../../test_helper.rb"
|
2
|
+
|
3
|
+
# TestOrganizations
|
4
|
+
class TestOrganizations < Minitest::Test
|
5
|
+
def self.test_order
|
6
|
+
:alpha
|
7
|
+
end
|
8
|
+
|
9
|
+
def setup
|
10
|
+
# Establish Connection
|
11
|
+
@compute = Fog::Compute::Packet.new(:packet_token => ENV["PACKET_TOKEN"])
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_a_create_organization
|
15
|
+
options = {
|
16
|
+
:name => "test_org",
|
17
|
+
:description => "test organization"
|
18
|
+
}
|
19
|
+
|
20
|
+
# Perform Request
|
21
|
+
response = @compute.organizations.create(options)
|
22
|
+
|
23
|
+
# Assertions
|
24
|
+
assert response
|
25
|
+
@@org_id = response.id
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_b_update_organization
|
29
|
+
options = {
|
30
|
+
:name => "test_org",
|
31
|
+
:description => "test organization"
|
32
|
+
}
|
33
|
+
org = @compute.organizations.get(@@org_id)
|
34
|
+
# Perform Request
|
35
|
+
org.name = options[:name]
|
36
|
+
org.description = options[:description]
|
37
|
+
|
38
|
+
response = org.update
|
39
|
+
|
40
|
+
# Assertions
|
41
|
+
assert response
|
42
|
+
assert_equal @@org_id, response.id
|
43
|
+
assert_equal options[:name], response.name
|
44
|
+
assert_equal options[:description], response.description
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_c_list_organizations
|
48
|
+
# Perform Request
|
49
|
+
response = @compute.organizations.all
|
50
|
+
|
51
|
+
# Assertions
|
52
|
+
assert !response.empty?
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_d_get_organization
|
56
|
+
org = @compute.organizations.get(@@org_id)
|
57
|
+
|
58
|
+
assert_equal @@org_id, org.id
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_z_delete_organization
|
62
|
+
org = @compute.organizations.get(@@org_id)
|
63
|
+
|
64
|
+
response = org.destroy
|
65
|
+
assert_equal true, response
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require_relative "../../test_helper.rb"
|
2
|
+
|
3
|
+
# TestPaymentMethods
|
4
|
+
class TestPaymentMethods < Minitest::Test
|
5
|
+
def self.test_order
|
6
|
+
:alpha
|
7
|
+
end
|
8
|
+
|
9
|
+
def setup
|
10
|
+
# Establish Connection
|
11
|
+
@compute = Fog::Compute::Packet.new(:packet_token => ENV["PACKET_TOKEN"])
|
12
|
+
@org_id = "6c17df6c-8769-4d98-b01f-f2848b6489a1"
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_a_request_create_payment_method
|
16
|
+
options = {
|
17
|
+
:name => "test",
|
18
|
+
:default => "false",
|
19
|
+
:nonce => "12",
|
20
|
+
:organization_id => @org_id
|
21
|
+
}
|
22
|
+
|
23
|
+
response = @compute.payment_methods.create(options)
|
24
|
+
|
25
|
+
assert response
|
26
|
+
@@payment_method_id = response.id
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_b_request_list_payment_methods
|
30
|
+
response = @compute.payment_methods.all(@org_id)
|
31
|
+
|
32
|
+
assert !response.empty?
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_c_request_get_payment_methods
|
36
|
+
response = @compute.payment_methods.get(@@payment_method_id)
|
37
|
+
|
38
|
+
assert_equal @@payment_method_id, response.id
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_d_request_update_payment_methods
|
42
|
+
pm = @compute.payment_methods.get(@@payment_method_id)
|
43
|
+
|
44
|
+
pm.name = "test_updated"
|
45
|
+
pm.expiration_month = 12
|
46
|
+
pm.expiration_year = 2022
|
47
|
+
response = pm.update
|
48
|
+
|
49
|
+
assert_equal @@payment_method_id, response.id
|
50
|
+
assert_equal pm.name, response.name
|
51
|
+
assert_equal pm.expiration_month, response.expiration_month
|
52
|
+
assert_equal pm.expiration_year, response.expiration_year
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_e_request_delete_payment_method
|
56
|
+
pm = @compute.payment_methods.get(@@payment_method_id)
|
57
|
+
|
58
|
+
response = pm.destroy
|
59
|
+
assert_equal true, response
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require_relative "../../test_helper.rb"
|
2
|
+
|
3
|
+
# TestPlans
|
4
|
+
class TestPlans < Minitest::Test
|
5
|
+
def self.test_order
|
6
|
+
:alpha
|
7
|
+
end
|
8
|
+
|
9
|
+
def setup
|
10
|
+
# Establish Connection
|
11
|
+
@compute = Fog::Compute::Packet.new(:packet_token => ENV["PACKET_TOKEN"])
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_list_facilities
|
15
|
+
plans = @compute.plans.all
|
16
|
+
|
17
|
+
assert !plans.empty?
|
18
|
+
end
|
19
|
+
end
|