Exemple #1
0
    def create_bay(self, values):
        # ensure defaults are present for new bays
        if not values.get('uuid'):
            values['uuid'] = utils.generate_uuid()

        bay = models.Bay()
        bay.update(values)
        try:
            bay.save()
        except db_exc.DBDuplicateEntry:
            raise exception.BayAlreadyExists(uuid=values['uuid'])
        return bay
Exemple #2
0
 def test_BayAlreadyExists(self):
     self.assertRaises(exception.BayAlreadyExists,
                       lambda: self.raise_(exception.BayAlreadyExists()))