Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
oVirt: Added tests to work on both real and mock.
Signed-off-by: Ohad Levy <ohadlevy@gmail.com>
- Loading branch information
Showing
36 changed files
with
842 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
.rvmrc | ||
.bundle | ||
.DS_Store | ||
.idea | ||
coverage | ||
doc/* | ||
docs/_site/* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
module Fog | ||
module Compute | ||
class Ovirt | ||
|
||
class Real | ||
def create_vm(attrs) | ||
client.create_vm(attrs) | ||
end | ||
end | ||
|
||
class Mock | ||
def create_vm(attrs) | ||
xml = read_xml('vm.xml') | ||
OVIRT::VM::new(self, Nokogiri::XML(xml).root) | ||
end | ||
|
||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
module Fog | ||
module Compute | ||
class Ovirt | ||
class Real | ||
def get_cluster(id) | ||
ovirt_attrs client.cluster(id) | ||
end | ||
|
||
end | ||
class Mock | ||
def get_cluster(id) | ||
xml = read_xml('cluster.xml') | ||
ovirt_attrs OVIRT::Cluster::new(self, Nokogiri::XML(xml).root) | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
module Fog | ||
module Compute | ||
class Ovirt | ||
class Real | ||
def get_template(id) | ||
ovirt_attrs client.template(id) | ||
end | ||
|
||
end | ||
class Mock | ||
def get_template(id) | ||
xml = read_xml 'template.xml' | ||
ovirt_attrs OVIRT::Template::new(self, Nokogiri::XML(xml).root) | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
module Fog | ||
module Compute | ||
class Ovirt | ||
class Real | ||
def get_virtual_machine(id) | ||
ovirt_attrs client.vm(id) | ||
end | ||
|
||
end | ||
class Mock | ||
def get_virtual_machine(id) | ||
xml = read_xml 'vm.xml' | ||
ovirt_attrs OVIRT::VM::new(self, Nokogiri::XML(xml).root) | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
module Fog | ||
module Compute | ||
class Ovirt | ||
class Real | ||
def list_clusters(filters = {}) | ||
client.clusters(filters).map {|ovirt_obj| ovirt_attrs ovirt_obj} | ||
end | ||
|
||
end | ||
class Mock | ||
def list_clusters(filters = {}) | ||
xml = read_xml 'clusters.xml' | ||
Nokogiri::XML(xml).xpath('/clusters/cluster').collect do |cl| | ||
ovirt_attrs OVIRT::Cluster::new(self, cl) | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
module Fog | ||
module Compute | ||
class Ovirt | ||
class Real | ||
def list_templates(filters = {}) | ||
client.templates(filters).map {|ovirt_obj| ovirt_attrs ovirt_obj} | ||
end | ||
|
||
end | ||
class Mock | ||
def list_templates(filters = {}) | ||
xml = read_xml 'templates.xml' | ||
Nokogiri::XML(xml).xpath('/templates/template').collect do |t| | ||
ovirt_attrs OVIRT::Template::new(self, t) | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.