Skip to content

Commit

Permalink
flip names in tests, add some aliases for retained names
Browse files Browse the repository at this point in the history
  • Loading branch information
vicomte committed Jun 15, 2024
1 parent 9cba0bf commit fcdd509
Show file tree
Hide file tree
Showing 17 changed files with 104 additions and 98 deletions.
3 changes: 3 additions & 0 deletions lib/fog/rackspace/compute.rb
Original file line number Diff line number Diff line change
Expand Up @@ -253,4 +253,7 @@ def authenticate_v1(options)
end
end
end

# fog-core 2.4.0 still users this definition
Compute::Rackspace = Fog::Rackspace::Compute
end
3 changes: 3 additions & 0 deletions lib/fog/rackspace/compute_v2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -250,4 +250,7 @@ def authenticate_v1(options)
end
end
end

# fog-core 2.4.0 still has this definitaion
Compute::RackspaceV2 = Fog::Rackspace::ComputeV2
end
4 changes: 2 additions & 2 deletions lib/fog/rackspace/models/compute_v2/virtual_interface.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
require 'fog/rackspace/models/compute_v2/virtual_interface'

module Fog
module Compute
class RackspaceV2
module Rackspace
class ComputeV2
class VirtualInterface < Fog::Model
# @!attribute [r] id
# @return [String] The virtual interface id
Expand Down
4 changes: 2 additions & 2 deletions lib/fog/rackspace/models/storage/account.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
require 'fog/core/model'

module Fog
module Storage
class Rackspace
module Rackspace
class Storage
class Account < Fog::Model
# @see http://docs.rackspace.com/files/api/v1/cf-devguide/content/View_Account_Info-d1e11995.html

Expand Down
4 changes: 2 additions & 2 deletions tests/helpers/succeeds_helper.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module Shindo
class Tests
def succeeds
def succeeds(&block)
test('succeeds') do
!!instance_eval(&Proc.new)
!!instance_eval(&block)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion tests/rackspace/cdn_tests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def assert_method(url, method)
end

tests('#authentication_method') do
@service = Fog::CDN::Rackspace.new
@service = Fog::Rackspace::CDN.new

assert_method nil, :authenticate_v2

Expand Down
2 changes: 1 addition & 1 deletion tests/rackspace/compute_tests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def assert_method(url, method)
end

tests('#authentication_method') do
@service = Fog::Compute::Rackspace.new
@service = Fog::Rackspace::Compute.new

assert_method nil, :authenticate_v2

Expand Down
2 changes: 1 addition & 1 deletion tests/rackspace/compute_v2_tests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def assert_method(url, method)
end

tests('#authentication_method') do
@service = Fog::Compute::RackspaceV2.new
@service = Fog::Rackspace::ComputeV2.new

assert_method nil, :authenticate_v2

Expand Down
2 changes: 1 addition & 1 deletion tests/rackspace/dns_tests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def assert_method(url, method)
end

tests('#authentication_method') do
@service = Fog::DNS::Rackspace.new
@service = Fog::Rackspace::DNS.new

assert_method nil, :authenticate_v2

Expand Down
4 changes: 2 additions & 2 deletions tests/rackspace/models/compute_v2/metadata_tests.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Shindo.tests('Fog::Compute::RackspaceV2 | metadata', ['rackspace']) do
Shindo.tests('Fog::Rackspace::ComputeV2 | metadata', ['rackspace']) do

pending if Fog.mocking?

service = Fog::Compute::RackspaceV2.new
service = Fog::Rackspace::ComputeV2.new
test_time = Time.now.to_i.to_s

tests('success') do
Expand Down
40 changes: 20 additions & 20 deletions tests/rackspace/models/compute_v2/server_tests.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Shindo.tests('Fog::Compute::RackspaceV2 | server', ['rackspace']) do
service = Fog::Compute::RackspaceV2.new
Shindo.tests('Fog::Rackspace::ComputeV2 | server', ['rackspace']) do
service = Fog::Rackspace::ComputeV2.new
cbs_service = Fog::Rackspace::BlockStorage.new

tests('setup test network').succeeds do
Expand All @@ -15,50 +15,50 @@
}

tests('ready?') do
@server = Fog::Compute::RackspaceV2::Server.new
@server = Fog::Rackspace::ComputeV2::Server.new

tests('default in ready state').returns(true) do
@server.state = Fog::Compute::RackspaceV2::Server::ACTIVE
@server.state = Fog::Rackspace::ComputeV2::Server::ACTIVE
@server.ready?
end

tests('custom ready state').returns(true) do
@server.state = Fog::Compute::RackspaceV2::Server::VERIFY_RESIZE
@server.ready?(Fog::Compute::RackspaceV2::Server::VERIFY_RESIZE)
@server.state = Fog::Rackspace::ComputeV2::Server::VERIFY_RESIZE
@server.ready?(Fog::Rackspace::ComputeV2::Server::VERIFY_RESIZE)
end

tests('default NOT in ready state').returns(false) do
@server.state = Fog::Compute::RackspaceV2::Server::REBOOT
@server.state = Fog::Rackspace::ComputeV2::Server::REBOOT
@server.ready?
end

tests('custom NOT ready state').returns(false) do
@server.state = Fog::Compute::RackspaceV2::Server::REBOOT
@server.ready?(Fog::Compute::RackspaceV2::Server::VERIFY_RESIZE)
@server.state = Fog::Rackspace::ComputeV2::Server::REBOOT
@server.ready?(Fog::Rackspace::ComputeV2::Server::VERIFY_RESIZE)
end

tests('default error state').returns(true) do
@server.state = Fog::Compute::RackspaceV2::Server::ERROR
@server.state = Fog::Rackspace::ComputeV2::Server::ERROR
exception_occurred = false
begin
@server.ready?
rescue Fog::Compute::RackspaceV2::InvalidServerStateException => e
rescue Fog::Rackspace::ComputeV2::InvalidServerStateException => e
exception_occurred = true
returns(true) {e.desired_state == Fog::Compute::RackspaceV2::Server::ACTIVE }
returns(true) {e.current_state == Fog::Compute::RackspaceV2::Server::ERROR }
returns(true) {e.desired_state == Fog::Rackspace::ComputeV2::Server::ACTIVE }
returns(true) {e.current_state == Fog::Rackspace::ComputeV2::Server::ERROR }
end
exception_occurred
end

tests('custom error state').returns(true) do
@server.state = Fog::Compute::RackspaceV2::Server::ACTIVE
@server.state = Fog::Rackspace::ComputeV2::Server::ACTIVE
exception_occurred = false
begin
@server.ready?(Fog::Compute::RackspaceV2::Server::VERIFY_RESIZE, Fog::Compute::RackspaceV2::Server::ACTIVE)
rescue Fog::Compute::RackspaceV2::InvalidServerStateException => e
@server.ready?(Fog::Rackspace::ComputeV2::Server::VERIFY_RESIZE, Fog::Rackspace::ComputeV2::Server::ACTIVE)
rescue Fog::Rackspace::ComputeV2::InvalidServerStateException => e
exception_occurred = true
returns(true) {e.desired_state == Fog::Compute::RackspaceV2::Server::VERIFY_RESIZE }
returns(true) {e.current_state == Fog::Compute::RackspaceV2::Server::ACTIVE }
returns(true) {e.desired_state == Fog::Rackspace::ComputeV2::Server::VERIFY_RESIZE }
returns(true) {e.current_state == Fog::Rackspace::ComputeV2::Server::ACTIVE }
end
exception_occurred
end
Expand Down Expand Up @@ -217,12 +217,12 @@
}

create_server = lambda { |attributes|
service = Fog::Compute::RackspaceV2.new
service = Fog::Rackspace::ComputeV2.new
attributes.merge!(:service => service)

Fog::SSH::Mock.data.clear

server = Fog::Compute::RackspaceV2::Server.new(attributes)
server = Fog::Rackspace::ComputeV2::Server.new(attributes)
server.save(attributes)

@address = 123
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Shindo.tests('Fog::Compute::RackspaceV2 | virtual_interface', ['rackspace']) do
Shindo.tests('Fog::Rackspace::ComputeV2 | virtual_interface', ['rackspace']) do
service = Fog::Compute::RackspaceV2.new

net_options = {
Expand Down
12 changes: 6 additions & 6 deletions tests/rackspace/models/storage/file_tests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,27 @@

tests("last_modified=") do
tests("no timezone") do
file = Fog::Storage::Rackspace::File.new
file = Fog::Rackspace::Storage::File.new
file.last_modified = "2013-05-09T22:20:59.287990"
returns(Fog::Time.utc(2013, 5, 9, 22, 20, 59, 287990, nil) == file.last_modified) { true }
end
tests("with timezone") do
file = Fog::Storage::Rackspace::File.new
file = Fog::Rackspace::Storage::File.new
file.last_modified = "Thu, 09 May 2015 22:20:59 GMT"
returns(Fog::Time.utc(2015, 5, 9, 22, 20, 59, 0, nil).to_i == file.last_modified.to_i) { true }
end
tests("with time") do
file = Fog::Storage::Rackspace::File.new
file = Fog::Rackspace::Storage::File.new
file.last_modified = Fog::Time.utc(2015, 5, 9, 22, 20, 59, 0, nil)
returns(Fog::Time.utc(2015, 5, 9, 22, 20, 59, 0, nil) == file.last_modified) { true }
end
tests("nil") do
file = Fog::Storage::Rackspace::File.new
file = Fog::Rackspace::Storage::File.new
file.last_modified = nil
returns(nil) { file.last_modified }
end
tests("empty string") do
file = Fog::Storage::Rackspace::File.new
file = Fog::Rackspace::Storage::File.new
file.last_modified = ""
returns("") { file.last_modified }
end
Expand Down Expand Up @@ -211,7 +211,7 @@ def clear_metadata
@file.destroy if @file
end

tests('invalid tag').raises(Fog::Storage::Rackspace::ServiceError) do
tests('invalid tag').raises(Fog::Rackspace::Storage::ServiceError) do
@directory.files.create :key => 'invalid-etag.txt', :body => text, :etag => "bad-bad-tag"
end
end
Expand Down
Loading

0 comments on commit fcdd509

Please sign in to comment.