Esempio n. 1
0
 def test_post(self):
     payload = {
                 "model_name": "Good_model",
                 "model_type": "GradientBoosting",
                 "model_params": {
                     "n_estimators": 50, "learning_rate": 0.1
                 },
                 "processor_params": {
                     "ngram_range": [4, 5],
                     "strip_accents": "unicode",
                     "analyzer": "char",
                     "max_features": 1000
                 }
             }
     response = app.test_client().post('/train', data=payload,
                                       content_type='application/json')
     assert response.status_code == 200
Esempio n. 2
0
def client():
    app.config["TESTING"] = True

    with app.test_client() as client:
        yield client
def client():
    with app.test_client() as testing_client:
        with app.app_context():
            yield testing_client
Esempio n. 4
0
 def test_put(self):
     payload = {"id": 1,
                "serving": True}
     response = app.test_client().put('/train', data=payload,
                                      content_type='application/json')
     assert response.status_code == 200
Esempio n. 5
0
 def test_get(self):
     response = app.test_client().get('/train', content_type='application/json')
     assert response.status_code == 200
Esempio n. 6
0
 def test_post(self):
     payload = {'email': '*****@*****.**',
                'model_name': 'wonderful_model'}
     response = app.test_client().post('/predict', data=payload,
                                       content_type='application/json')
     assert response.status_code == 200