Beispiel #1
0
 def test_should_raise_validation_error_when_slot_no_is_busy(self):
     model = DataCenterAssetModelFactory(has_parent=True)
     DataCenterAssetFactory(parent=self.dc_asset, slot_no=1, model=model)
     dc_asset = DataCenterAssetFactory(parent=self.dc_asset, model=model)
     dc_asset.slot_no = 1
     with self.assertRaises(ValidationError):
         dc_asset.clean()
Beispiel #2
0
 def test_should_pass_when_slot_no_is_busy_but_different_orientation(self):
     model = DataCenterAssetModelFactory(has_parent=True)
     DataCenterAssetFactory(
         parent=self.dc_asset,
         slot_no=1,
         model=model,
         orientation=Orientation.back,
     )
     dc_asset = DataCenterAssetFactory(parent=self.dc_asset, model=model)
     dc_asset.slot_no = 1
     dc_asset._validate_slot_no()
Beispiel #3
0
 def test_should_pass_when_slot_no_filled_on_blade(self):
     dc_asset = DataCenterAssetFactory(model__has_parent=True)
     dc_asset.slot_no = '1A'
     dc_asset._validate_slot_no()
Beispiel #4
0
 def test_should_raise_validation_error_when_slot_not_filled_when_not_blade(
         self):  # noqa
     dc_asset = DataCenterAssetFactory(model__has_parent=False)
     dc_asset.slot_no = '1A'
     with self.assertRaises(ValidationError):
         dc_asset._validate_slot_no()
Beispiel #5
0
 def test_should_raise_validation_error_when_empty_slot_no_on_blade(self):
     dc_asset = DataCenterAssetFactory(model__has_parent=True)
     dc_asset.slot_no = ''
     with self.assertRaises(ValidationError):
         dc_asset._validate_slot_no()