Permalink
Browse files

Merge pull request #1446 from ehowe/master

[ecloud] improvements and mocking
  • Loading branch information...
2 parents b011305 + 853755d commit e21a308b5466fae23c1b2e6f767be5a92fe4a50a @geemus geemus committed Jan 4, 2013
Showing with 2,799 additions and 676 deletions.
  1. +2 −2 lib/fog/core/collection.rb
  2. +19 −5 lib/fog/ecloud.rb
  3. +663 −351 lib/fog/ecloud/compute.rb
  4. +14 −10 lib/fog/ecloud/models/compute/admin_organization.rb
  5. +0 −5 lib/fog/ecloud/models/compute/admin_organizations.rb
  6. +20 −8 lib/fog/ecloud/models/compute/compute_pool.rb
  7. +27 −0 lib/fog/ecloud/models/compute/detached_disk.rb
  8. +31 −0 lib/fog/ecloud/models/compute/detached_disks.rb
  9. +13 −6 lib/fog/ecloud/models/compute/environment.rb
  10. +1 −1 lib/fog/ecloud/models/compute/environments.rb
  11. +2 −0 lib/fog/ecloud/models/compute/group.rb
  12. +16 −5 lib/fog/ecloud/models/compute/groups.rb
  13. +4 −4 lib/fog/ecloud/models/compute/hardware_configuration.rb
  14. +1 −1 lib/fog/ecloud/models/compute/hardware_configurations.rb
  15. +19 −13 lib/fog/ecloud/models/compute/internet_service.rb
  16. +9 −6 lib/fog/ecloud/models/compute/internet_services.rb
  17. +17 −3 lib/fog/ecloud/models/compute/ip_address.rb
  18. +6 −1 lib/fog/ecloud/models/compute/ip_addresses.rb
  19. +1 −1 lib/fog/ecloud/models/compute/layout.rb
  20. +18 −8 lib/fog/ecloud/models/compute/network.rb
  21. +8 −4 lib/fog/ecloud/models/compute/networks.rb
  22. +8 −2 lib/fog/ecloud/models/compute/node.rb
  23. +5 −2 lib/fog/ecloud/models/compute/nodes.rb
  24. +1 −1 lib/fog/ecloud/models/compute/operating_system_family.rb
  25. +5 −5 lib/fog/ecloud/models/compute/organization.rb
  26. +1 −1 lib/fog/ecloud/models/compute/public_ip.rb
  27. +5 −2 lib/fog/ecloud/models/compute/public_ips.rb
  28. +5 −2 lib/fog/ecloud/models/compute/row.rb
  29. +6 −3 lib/fog/ecloud/models/compute/rows.rb
  30. +123 −77 lib/fog/ecloud/models/compute/server.rb
  31. +15 −12 lib/fog/ecloud/models/compute/servers.rb
  32. +1 −1 lib/fog/ecloud/models/compute/ssh_key.rb
  33. +3 −0 lib/fog/ecloud/models/compute/task.rb
  34. +8 −9 lib/fog/ecloud/models/compute/template.rb
  35. +32 −0 lib/fog/ecloud/models/compute/virtual_machine_assigned_ip.rb
  36. +27 −0 lib/fog/ecloud/models/compute/virtual_machine_assigned_ips.rb
  37. +1 −2 lib/fog/ecloud/requests/compute/admin_edit_authentication_levels.rb
  38. +14 −0 lib/fog/ecloud/requests/compute/get_admin_organization.rb
  39. +0 −11 lib/fog/ecloud/requests/compute/get_admin_organizations.rb
  40. +11 −0 lib/fog/ecloud/requests/compute/get_compute_pool.rb
  41. +21 −0 lib/fog/ecloud/requests/compute/get_compute_pools.rb
  42. +21 −0 lib/fog/ecloud/requests/compute/get_detached_disk.rb
  43. +33 −0 lib/fog/ecloud/requests/compute/get_detached_disks.rb
  44. +21 −0 lib/fog/ecloud/requests/compute/get_environment.rb
  45. +8 −1 lib/fog/ecloud/requests/compute/get_group.rb
  46. +8 −1 lib/fog/ecloud/requests/compute/get_groups.rb
  47. +19 −0 lib/fog/ecloud/requests/compute/get_hardware_configuration.rb
  48. +4 −0 lib/fog/ecloud/requests/compute/get_hardware_configurations.rb
  49. +12 −0 lib/fog/ecloud/requests/compute/get_internet_service.rb
  50. +8 −0 lib/fog/ecloud/requests/compute/get_internet_services.rb
  51. +11 −0 lib/fog/ecloud/requests/compute/get_ip_address.rb
  52. +0 −11 lib/fog/ecloud/requests/compute/get_ip_addresses.rb
  53. +8 −1 lib/fog/ecloud/requests/compute/get_layout.rb
  54. +8 −1 lib/fog/ecloud/requests/compute/get_layouts.rb
  55. +11 −0 lib/fog/ecloud/requests/compute/get_network.rb
  56. +20 −0 lib/fog/ecloud/requests/compute/get_networks.rb
  57. +11 −0 lib/fog/ecloud/requests/compute/get_node.rb
  58. +9 −0 lib/fog/ecloud/requests/compute/get_nodes.rb
  59. +14 −0 lib/fog/ecloud/requests/compute/get_operating_system.rb
  60. +20 −0 lib/fog/ecloud/requests/compute/get_operating_system_families.rb
  61. +0 −11 lib/fog/ecloud/requests/compute/get_operating_system_family.rb
  62. +14 −0 lib/fog/ecloud/requests/compute/get_organization.rb
  63. +14 −2 lib/fog/ecloud/requests/compute/get_organizations.rb
  64. +11 −1 lib/fog/ecloud/requests/compute/get_public_ip.rb
  65. +22 −0 lib/fog/ecloud/requests/compute/get_public_ips.rb
  66. +8 −1 lib/fog/ecloud/requests/compute/get_row.rb
  67. +2 −1 lib/fog/ecloud/requests/compute/get_rows.rb
  68. +11 −0 lib/fog/ecloud/requests/compute/get_server.rb
  69. +32 −1 lib/fog/ecloud/requests/compute/get_servers.rb
  70. +11 −0 lib/fog/ecloud/requests/compute/get_ssh_key.rb
  71. +20 −0 lib/fog/ecloud/requests/compute/get_ssh_keys.rb
  72. +4 −2 lib/fog/ecloud/requests/compute/get_task.rb
  73. +11 −0 lib/fog/ecloud/requests/compute/get_template.rb
  74. +38 −0 lib/fog/ecloud/requests/compute/get_templates.rb
  75. +44 −0 lib/fog/ecloud/requests/compute/get_virtual_machine_assigned_ips.rb
  76. +16 −1 lib/fog/ecloud/requests/compute/groups_delete.rb
  77. +36 −1 lib/fog/ecloud/requests/compute/internet_service_create.rb
  78. +23 −0 lib/fog/ecloud/requests/compute/internet_service_delete.rb
  79. +49 −1 lib/fog/ecloud/requests/compute/node_service_create.rb
  80. +24 −0 lib/fog/ecloud/requests/compute/node_service_delete.rb
  81. +11 −1 lib/fog/ecloud/requests/compute/rows_delete.rb
  82. +0 −40 lib/fog/ecloud/requests/compute/virtual_machine_add_ip.rb
  83. +62 −0 lib/fog/ecloud/requests/compute/virtual_machine_attach_disk.rb
  84. +136 −16 lib/fog/ecloud/requests/compute/virtual_machine_create_from_template.rb
  85. +36 −1 lib/fog/ecloud/requests/compute/virtual_machine_delete.rb
  86. +71 −0 lib/fog/ecloud/requests/compute/virtual_machine_detach_disk.rb
  87. +82 −0 lib/fog/ecloud/requests/compute/virtual_machine_edit_assigned_ips.rb
  88. +27 −3 lib/fog/ecloud/requests/compute/virtual_machine_edit_hardware_configuration.rb
  89. +120 −6 lib/fog/ecloud/requests/compute/virtual_machine_import.rb
  90. +27 −6 tests/compute/helper.rb
  91. +1 −1 tests/compute/models/flavors_tests.rb
  92. +2 −0 tests/compute/models/server_tests.rb
  93. +2 −1 tests/compute/models/servers_tests.rb
  94. +16 −0 tests/ecloud/compute/models/admin_organization_tests.rb
  95. +17 −0 tests/ecloud/compute/models/compute_pool_tests.rb
  96. +26 −0 tests/ecloud/compute/models/detached_disk_tests.rb
  97. +23 −0 tests/ecloud/compute/models/environment_tests.rb
  98. +28 −0 tests/ecloud/compute/models/internet_service_tests.rb
  99. +19 −0 tests/ecloud/compute/models/ip_address_tests.rb
  100. +17 −0 tests/ecloud/compute/models/network_tests.rb
  101. +13 −0 tests/ecloud/compute/models/operating_system_families_tests.rb
  102. +22 −0 tests/ecloud/compute/models/operating_system_tests.rb
  103. +21 −0 tests/ecloud/compute/models/organization_tests.rb
  104. +19 −0 tests/ecloud/compute/models/public_ip_tests.rb
  105. +143 −0 tests/ecloud/compute/models/server_tests.rb
  106. +19 −0 tests/ecloud/compute/models/ssh_key_tests.rb
  107. +20 −0 tests/ecloud/compute/models/template_tests.rb
@@ -103,10 +103,10 @@ def new(attributes = {})
raise(ArgumentError.new("Initialization parameters must be an attributes hash, got #{attributes.class} #{attributes.inspect}"))
end
model.new(
- attributes.merge(
+ {
:collection => self,
:connection => connection
- )
+ }.merge(attributes)
)
end
View
@@ -2,16 +2,30 @@
module Fog
module Ecloud
+ ECLOUD_OPTIONS = [:ecloud_authentication_method]
extend Fog::Provider
service(:compute, 'ecloud/compute', 'Compute')
- end
-end
+ def self.keep(hash, *keys)
+ {}.tap do |kept|
+ keys.each{|k| kept[k]= hash[k] if hash.key?(k)}
+ end
+ end
-module Fog
- module Ecloud
- ECLOUD_OPTIONS = [:ecloud_authentication_method]
+ def self.slice(hash, *keys)
+ hash.dup.tap do |sliced|
+ keys.each{|k| sliced.delete(k)}
+ end
+ end
+
+ def self.ip_address
+ 4.times.map{ Fog::Mock.random_numbers(3) }.join(".")
+ end
+
+ def self.mac_address
+ 6.times.map{ Fog::Mock.random_numbers(2) }.join(":")
+ end
end
end
Oops, something went wrong.

0 comments on commit e21a308

Please sign in to comment.