Skip to content

Commit

Permalink
fixed more failing tests since ext is no longer a part of uploaded fi…
Browse files Browse the repository at this point in the history
…le paths
  • Loading branch information
workaryangupta committed Jul 3, 2024
1 parent 0b68218 commit 69a9ecc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
10 changes: 5 additions & 5 deletions tests/_test_mscolab/test_file_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
from werkzeug.datastructures import FileStorage

from mslib.mscolab.models import Operation, User
from mslib.mscolab.seed import add_user, get_user, add_operation, add_user_to_operation
from mslib.mscolab.seed import add_user, get_user, add_operation


class Test_FileManager:
Expand All @@ -41,7 +41,6 @@ def setup(self, mscolab_app, mscolab_managers):
_, _, self.fm = mscolab_managers
self.userdata = 'UV10@uv10', 'UV10', 'uv10'
self.anotheruserdata = 'UV20@uv20', 'UV20', 'uv20'
self.operation_name = "europe"

assert add_user(self.userdata[0], self.userdata[1], self.userdata[2])
self.user = get_user(self.userdata[0])
Expand All @@ -61,8 +60,6 @@ def setup(self, mscolab_app, mscolab_managers):
assert add_user('UV80@uv80', 'UV80', 'uv80')
self.adminuser = get_user('UV80@uv80')
self._example_data()
assert add_operation(self.operation_name, "test europe")
assert add_user_to_operation(path=self.operation_name, emailid=self.userdata[0])
with self.app.app_context():
yield

Expand Down Expand Up @@ -257,11 +254,14 @@ def test_upload_chat_attachment(self):
Tests the chat feature to upload files.
i.e. it tests the upload_file method of file manager in case of it being used to upload a chat attachment
'''
operation_name = "europe"
assert add_operation(operation_name, "test europe")
operation = Operation.query.filter_by(path=operation_name).first()

sample_path = os.path.join(os.path.dirname(__file__), "..", "data")
filename = "example.csv"
name, _ = filename.split('.')
open_csv = os.path.join(sample_path, "example.csv")
operation = Operation.query.filter_by(path=self.operation_name).first()
with open(open_csv, 'rb') as fp:
file = FileStorage(fp, filename=filename, content_type="text/csv")
static_path = self.fm.upload_file(file, subfolder=str(operation.id), identifier=None)
Expand Down
1 change: 0 additions & 1 deletion tests/_test_mscolab/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ def test_message_attachment(self):
assert response.status_code == 200
data = json.loads(response.data.decode('utf-8'))
pfn = data["path"]
assert "txt" in pfn
assert "uploads" in pfn

def test_uploads(self):
Expand Down
1 change: 0 additions & 1 deletion tests/_test_mscolab/test_sockets_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,4 +305,3 @@ def test_upload_file(self):
assert os.path.exists(upload_dir)
file = os.listdir(upload_dir)[0]
assert 'mss-logo' in file
assert 'png' in file

0 comments on commit 69a9ecc

Please sign in to comment.