[Ovirt-devel] [PATCH server] fixes to the bonding tests

Mohammed Morsi mmorsi at redhat.com
Thu Oct 9 20:44:49 UTC 2008


---
 src/app/models/bonding.rb      |    2 ++
 src/app/models/bonding_type.rb |    2 ++
 src/test/unit/bonding_test.rb  |    9 ---------
 3 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/src/app/models/bonding.rb b/src/app/models/bonding.rb
index 941e2cd..eb25d05 100644
--- a/src/app/models/bonding.rb
+++ b/src/app/models/bonding.rb
@@ -36,6 +36,8 @@ class Bonding < ActiveRecord::Base
   validates_presence_of :interface_name,
     :message => 'An interface name is required.'
 
+  validates_presence_of :host_id
+
   belongs_to :host
   belongs_to :bonding_type
 
diff --git a/src/app/models/bonding_type.rb b/src/app/models/bonding_type.rb
index e0d2193..7697ff4 100644
--- a/src/app/models/bonding_type.rb
+++ b/src/app/models/bonding_type.rb
@@ -23,4 +23,6 @@
 class BondingType < ActiveRecord::Base
   validates_presence_of :label
   validates_presence_of :mode
+
+  validates_uniqueness_of :mode
 end
diff --git a/src/test/unit/bonding_test.rb b/src/test/unit/bonding_test.rb
index 4bdb079..1dbab38 100644
--- a/src/test/unit/bonding_test.rb
+++ b/src/test/unit/bonding_test.rb
@@ -30,7 +30,6 @@ class BondingTest < ActiveSupport::TestCase
     @bonding = Bonding.new(
       :name           => 'Bonding1',
       :interface_name => 'bond0',
-      :type_id        => bonding_types(:failover_bonding_type),
       :host_id        => hosts(:mailservers_managed_node))
   end
 
@@ -50,14 +49,6 @@ class BondingTest < ActiveSupport::TestCase
     flunk 'Bondings have to have an interface name.' if @bonding.valid?
   end
 
-  # Ensures that the bonding type is required.
-  #
-  def test_valid_fails_without_type
-    @bonding.type_id = nil
-
-    flunk 'Bondings have to have a valid type.' if @bonding.valid?
-  end
-
   # Ensures that a host is required
   #
   def test_valid_fails_without_host
-- 
1.5.5.1




More information about the ovirt-devel mailing list