Example #1
0
 def test_predictor_destroy(self):
     values = get_fake_predictor('1')
     predictor = db_api.predictor_create(self.conf, values)
     db_api.predictor_destroy(self.conf, predictor['id'])
     with self.assertRaises(exception.PredictorNotFound) as cm:
         db_api.predictor_get(self.conf, predictor['id'])
     err = cm.exception
     self.assertEqual(err.kwargs, {'predictor_id': predictor['id']})
Example #2
0
 def test_predictor_destroy_by_sf_id(self):
     values = get_fake_predictor('1')
     predictor_ref1 = db_api.predictor_create(self.conf, values)
     values = get_fake_predictor('2')
     predictor_ref2 = db_api.predictor_create(self.conf, values)
     db_api.predictor_destroy_by_sf_id(self.conf, '1')
     with self.assertRaises(exception.PredictorNotFound) as cm:
         db_api.predictor_get(self.conf, predictor_ref1['id'])
     err = cm.exception
     self.assertEqual(err.kwargs, {'predictor_id': predictor_ref1['id']})
     predictor_ref3 = db_api.predictor_get(self.conf, predictor_ref2['id'])
     self.assertEqual(predictor_ref3['id'], predictor_ref2['id'])
 def test_predictor_destroy_by_sf_id(self):
     values = get_fake_predictor("1")
     predictor_ref1 = db_api.predictor_create(self.conf, values)
     values = get_fake_predictor("2")
     predictor_ref2 = db_api.predictor_create(self.conf, values)
     db_api.predictor_destroy_by_sf_id(self.conf, "1")
     with self.assertRaises(exception.PredictorNotFound) as cm:
         db_api.predictor_get(self.conf, predictor_ref1["id"])
     err = cm.exception
     self.assertEqual(err.kwargs, {"predictor_id": predictor_ref1["id"]})
     predictor_ref3 = db_api.predictor_get(self.conf, predictor_ref2["id"])
     self.assertEqual(dict(predictor_ref2.iteritems()), dict(predictor_ref3.iteritems()))
Example #4
0
 def test_predictor_get(self):
     values = get_fake_predictor('1')
     predictor_ref1 = db_api.predictor_create(self.conf, values)
     predictor_ref2 = db_api.predictor_get(self.conf, predictor_ref1['id'])
     self.assertEqual(dict(predictor_ref1.iteritems()),
                      dict(predictor_ref2.iteritems()))