Skip to content

Commit

Permalink
update test_post_train_succes with testzip() function
Browse files Browse the repository at this point in the history
  • Loading branch information
EPedrotti committed Feb 25, 2019
1 parent eb28699 commit 246ee2b
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions tests/base/test_server.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
import io
import json
import os
import tempfile
import time

Expand Down Expand Up @@ -148,6 +147,7 @@ def test_post_train(app, rasa_default_train_data):
@utilities.slowtest
@pytest.inlineCallbacks
def test_post_train_success(app, rasa_default_train_data):
import zipfile
model_config = {"pipeline": "keyword", "data": rasa_default_train_data}

response = app.post("http://dummy-uri/train?project=test&model=test",
Expand All @@ -157,12 +157,7 @@ def test_post_train_success(app, rasa_default_train_data):
response = yield response
content = yield response.content()
assert response.code == 200
with io.open('./test_download.zip', 'wb') as f:
f.write(content)
import zipfile
zip_name = "./test_download.zip"
assert zipfile.is_zipfile(zip_name)
os.remove(zip_name)
assert zipfile.ZipFile(io.BytesIO(content)).testzip() is None


@utilities.slowtest
Expand Down

0 comments on commit 246ee2b

Please sign in to comment.