Ejemplo n.º 1
0
 def test_release_non_exists_validation(self):
     with patch('nailgun.api.validators.cluster.Release', Mock()) as r:
         try:
             r.get_by_uuid.return_value = None
             ClusterValidator.validate(self.cluster_data)
         except errors.InvalidData as e:
             self.fail('Release exists validation failed: {0}'.format(e))
Ejemplo n.º 2
0
 def test_release_non_exists_validation(self):
     with patch('nailgun.api.validators.cluster.Release', Mock()) as r:
         try:
             r.get_by_uuid.return_value = None
             ClusterValidator.validate(self.cluster_data)
         except errors.InvalidData as e:
             self.fail('Release exists validation failed: {0}'.format(e))
Ejemplo n.º 3
0
 def test_release_non_exists_validation(self):
     with patch('nailgun.api.validators.cluster.db', Mock()) as db:
         try:
             db.return_value.query.return_value.get.\
                 return_value = 'release'
             ClusterValidator.validate(self.release_data)
         except errors.InvalidData as e:
             self.fail('Release exists validation failed: {0}'.format(e))
Ejemplo n.º 4
0
 def test_cluster_non_exists_validation(self):
     with patch('nailgun.api.validators.cluster.db', Mock()) as db:
         try:
             db.return_value.query.return_value.filter_by.\
                 return_value.first.return_value = None
             ClusterValidator.validate(self.cluster_data)
         except errors.AlreadyExists as e:
             self.fail('Cluster exists validation failed: {0}'.format(e))
 def test_release_non_exists_validation(self):
     with patch('nailgun.api.validators.cluster.db', Mock()) as db:
         try:
             db.return_value.query.return_value.get.\
                 return_value = 'release'
             ClusterValidator.validate(self.release_data)
         except errors.InvalidData as e:
             self.fail('Release exists validation failed: {0}'.format(e))
 def test_cluster_non_exists_validation(self):
     with patch('nailgun.api.validators.cluster.db', Mock()) as db:
         try:
             db.return_value.query.return_value.filter_by.\
                 return_value.first.return_value = None
             ClusterValidator.validate(self.cluster_data)
         except errors.AlreadyExists as e:
             self.fail('Cluster exists validation failed: {0}'.format(e))
Ejemplo n.º 7
0
 def test_cluster_non_exists_validation(self):
     with nested(
             patch('nailgun.api.validators.cluster.ClusterCollection',
                   Mock()),
             patch('nailgun.api.validators.cluster.Release',
                   Mock())) as (cc, r):
         try:
             cc.filter_by.return_value.first.return_value = None
             r.get_by_uuid.return_value = 'release'
             ClusterValidator.validate(self.cluster_data)
         except errors.AlreadyExists as e:
             self.fail('Cluster exists validation failed: {0}'.format(e))
Ejemplo n.º 8
0
 def test_cluster_non_exists_validation(self):
     with nested(
         patch('nailgun.api.validators.cluster.ClusterCollection', Mock()),
         patch('nailgun.api.validators.cluster.Release', Mock())
     ) as (cc, r):
         try:
             cc.filter_by.return_value.first.return_value = None
             r.get_by_uuid.return_value = 'release'
             ClusterValidator.validate(self.cluster_data)
         except errors.AlreadyExists as e:
             self.fail(
                 'Cluster exists validation failed: {0}'.format(e)
             )