Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GSoC Progress Update 2 - Integrated plugins, refactored tests #1079

Merged
merged 3 commits into from
Jul 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions mslib/mscolab/_tests/test_chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
from mslib.mscolab.conf import mscolab_settings
from mslib.mscolab.models import Message, MessageType
from mslib.msui.icons import icons
from mslib.msui.mscolab import MSSMscolabWindow
from mslib._tests.utils import mscolab_start_server
import mslib.msui.mss_pyui as mss_pyui


PORTS = list(range(9300, 9320))
Expand All @@ -52,17 +52,16 @@ def setup(self):
self.process, self.url, self.app, _, self.cm, self.fm = mscolab_start_server(PORTS)
QtTest.QTest.qWait(500)
self.application = QtWidgets.QApplication(sys.argv)
self.window = MSSMscolabWindow(data_dir=mscolab_settings.MSCOLAB_DATA_DIR,
mscolab_server_url=self.url)
self.window = mss_pyui.MSSMainWindow(mscolab_data_dir=mscolab_settings.MSCOLAB_DATA_DIR)
self.sockets = []

def teardown(self):
for socket in self.sockets:
socket.disconnect()
if self.window.version_window:
self.window.version_window.close()
if self.window.conn:
self.window.conn.disconnect()
if self.window.mscolab.version_window:
self.window.mscolab.version_window.close()
if self.window.mscolab.conn:
self.window.mscolab.conn.disconnect()
self.window.hide()
QtWidgets.QApplication.processEvents()
self.application.quit()
Expand Down
13 changes: 6 additions & 7 deletions mslib/mscolab/_tests/test_chat_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
from mslib.mscolab.models import User, MessageType, Message
from mslib.mscolab.conf import mscolab_settings
from mslib.mscolab.chat_manager import ChatManager
from mslib.msui.mscolab import MSSMscolabWindow
from mslib._tests.utils import mscolab_start_server
import mslib.msui.mss_pyui as mss_pyui


PORTS = list(range(9321, 9340))
Expand All @@ -48,8 +48,7 @@ def setup(self):
self.process, self.url, self.app, _, self.cm, self.fm = mscolab_start_server(PORTS)
QtTest.QTest.qWait(500)
self.application = QtWidgets.QApplication(sys.argv)
self.window = MSSMscolabWindow(data_dir=mscolab_settings.MSCOLAB_DATA_DIR,
mscolab_server_url=self.url)
self.window = mss_pyui.MSSMainWindow(mscolab_data_dir=mscolab_settings.MSCOLAB_DATA_DIR)
self.cm = ChatManager()
self.room_name = "europe"
data = {
Expand All @@ -70,10 +69,10 @@ def setup(self):
requests.post(url, data=data)

def teardown(self):
if self.window.version_window:
self.window.version_window.close()
if self.window.conn:
self.window.conn.disconnect()
if self.window.mscolab.version_window:
self.window.mscolab.version_window.close()
if self.window.mscolab.conn:
self.window.mscolab.conn.disconnect()
self.application.quit()
QtWidgets.QApplication.processEvents()
self.process.terminate()
Expand Down
13 changes: 6 additions & 7 deletions mslib/mscolab/_tests/test_file_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
from mslib.mscolab.conf import mscolab_settings
from mslib.mscolab import file_manager
from mslib.mscolab.models import User, Project
from mslib.msui.mscolab import MSSMscolabWindow
from mslib._tests.utils import mscolab_start_server
import mslib.msui.mss_pyui as mss_pyui

PORTS = list(range(19341, 19390))

Expand All @@ -46,8 +46,7 @@ def setup(self):
self.process, self.url, self.app, _, self.cm, self.fm = mscolab_start_server(PORTS)
QtTest.QTest.qWait(500)
self.application = QtWidgets.QApplication(sys.argv)
self.window = MSSMscolabWindow(data_dir=mscolab_settings.MSCOLAB_DATA_DIR,
mscolab_server_url=self.url)
self.window = mss_pyui.MSSMainWindow(mscolab_data_dir=mscolab_settings.MSCOLAB_DATA_DIR)
self.sockets = []
self.fm = file_manager.FileManager(mscolab_settings.MSCOLAB_DATA_DIR)
self._example_data()
Expand All @@ -64,10 +63,10 @@ def setup(self):
def teardown(self):
for socket in self.sockets:
socket.disconnect()
if self.window.version_window:
self.window.version_window.close()
if self.window.conn:
self.window.conn.disconnect()
if self.window.mscolab.version_window:
self.window.mscolab.version_window.close()
if self.window.mscolab.conn:
self.window.mscolab.conn.disconnect()
self.application.quit()
QtWidgets.QApplication.processEvents()
self.process.terminate()
Expand Down
13 changes: 6 additions & 7 deletions mslib/mscolab/_tests/test_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
from mslib.mscolab.models import db, User, Project, Change, Permission, Message
from mslib.mscolab.utils import get_recent_pid
from mslib._tests.utils import mscolab_register_and_login, mscolab_create_project, mscolab_start_server
from mslib.msui.mscolab import MSSMscolabWindow
import mslib.msui.mss_pyui as mss_pyui


PORTS = list(range(9361, 9380))
Expand All @@ -53,8 +53,7 @@ def setup(self):
self.process, self.url, self.app, _, self.cm, self.fm = mscolab_start_server(PORTS)
QtTest.QTest.qWait(500)
self.application = QtWidgets.QApplication(sys.argv)
self.window = MSSMscolabWindow(data_dir=mscolab_settings.MSCOLAB_DATA_DIR,
mscolab_server_url=self.url)
self.window = mss_pyui.MSSMainWindow(mscolab_data_dir=mscolab_settings.MSCOLAB_DATA_DIR)
self.sockets = []
self.file_message_counter = [0] * 2
with self.app.app_context():
Expand All @@ -63,10 +62,10 @@ def setup(self):
def teardown(self):
for socket in self.sockets:
socket.disconnect()
if self.window.version_window:
self.window.version_window.close()
if self.window.conn:
self.window.conn.disconnect()
if self.window.mscolab.version_window:
self.window.mscolab.version_window.close()
if self.window.mscolab.conn:
self.window.mscolab.conn.disconnect()
self.application.quit()
QtWidgets.QApplication.processEvents()
self.process.terminate()
Expand Down
13 changes: 6 additions & 7 deletions mslib/mscolab/_tests/test_files_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
from mslib.mscolab.server import db
from mslib.mscolab.utils import get_recent_pid
from mslib._tests.utils import mscolab_register_and_login, mscolab_create_project, mscolab_start_server
from mslib.msui.mscolab import MSSMscolabWindow
import mslib.msui.mss_pyui as mss_pyui


PORTS = list(range(9381, 9400))
Expand All @@ -50,8 +50,7 @@ def setup(self):
self.process, self.url, self.app, _, self.cm, self.fm = mscolab_start_server(PORTS)
QtTest.QTest.qWait(500)
self.application = QtWidgets.QApplication(sys.argv)
self.window = MSSMscolabWindow(data_dir=mscolab_settings.MSCOLAB_DATA_DIR,
mscolab_server_url=self.url)
self.window = mss_pyui.MSSMainWindow(mscolab_data_dir=mscolab_settings.MSCOLAB_DATA_DIR)
self.sockets = []
self.file_message_counter = [0] * 2
self.undefined_p_id = 123
Expand All @@ -68,10 +67,10 @@ def setup(self):
def teardown(self):
for socket in self.sockets:
socket.disconnect()
if self.window.version_window:
self.window.version_window.close()
if self.window.conn:
self.window.conn.disconnect()
if self.window.mscolab.version_window:
self.window.mscolab.version_window.close()
if self.window.mscolab.conn:
self.window.mscolab.conn.disconnect()
self.application.quit()
QtWidgets.QApplication.processEvents()
self.process.terminate()
Expand Down
13 changes: 6 additions & 7 deletions mslib/mscolab/_tests/test_seed.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@
"""

import sys
from mslib.msui.mscolab import MSSMscolabWindow
from PyQt5 import QtTest, QtWidgets
from mslib.mscolab.models import User
from mslib.mscolab.conf import mscolab_settings
from mslib._tests.utils import (mscolab_register_and_login,
mscolab_create_project, mscolab_delete_all_projects,
mscolab_delete_user, mscolab_start_server)
from mslib.mscolab.seed import add_all_users_default_project, add_user, delete_user
import mslib.msui.mss_pyui as mss_pyui


PORTS = list(range(19571, 19590))
Expand All @@ -45,8 +45,7 @@ def setup(self):
self.process, self.url, self.app, _, self.cm, self.fm = mscolab_start_server(PORTS, mscolab_settings)
QtTest.QTest.qWait(100)
self.application = QtWidgets.QApplication(sys.argv)
self.window = MSSMscolabWindow(data_dir=mscolab_settings.MSCOLAB_DATA_DIR,
mscolab_server_url=self.url)
self.window = mss_pyui.MSSMainWindow(mscolab_data_dir=mscolab_settings.MSCOLAB_DATA_DIR)
with self.app.app_context():
response = mscolab_register_and_login(self.app, self.url, 'UV0@uv0', 'UV0', 'uv0')
assert response.status == '200 OK'
Expand All @@ -66,10 +65,10 @@ def teardown(self):
user = User.query.filter_by(emailid="UV2@v2").first()
if user is not None:
delete_user('UV2@uv2')
if self.window.version_window:
self.window.version_window.close()
if self.window.conn:
self.window.conn.disconnect()
if self.window.mscolab.version_window:
self.window.mscolab.version_window.close()
if self.window.mscolab.conn:
self.window.mscolab.conn.disconnect()
self.application.quit()
QtWidgets.QApplication.processEvents()
self.process.terminate()
Expand Down
26 changes: 12 additions & 14 deletions mslib/mscolab/_tests/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@
from werkzeug.urls import url_join
from mslib.mscolab.conf import mscolab_settings
from mslib.mscolab import server
from mslib.msui.mscolab import MSSMscolabWindow
from mslib.mscolab.models import User
from mslib._tests.utils import (mscolab_register_user,
mscolab_register_and_login, mscolab_create_content,
mscolab_create_project,
mscolab_delete_user, mscolab_login, mscolab_start_server)
from PyQt5 import QtWidgets, QtTest
import mslib.msui.mss_pyui as mss_pyui

PORTS = list(range(10481, 10530))

Expand All @@ -50,17 +50,16 @@ def setup(self):
self.process, self.url, self.app, self.sockio, self.cm, self.fm = mscolab_start_server(PORTS)
QtTest.QTest.qWait(500)
self.application = QtWidgets.QApplication(sys.argv)
self.window = MSSMscolabWindow(data_dir=mscolab_settings.MSCOLAB_DATA_DIR,
mscolab_server_url=self.url)
self.window = mss_pyui.MSSMainWindow(mscolab_data_dir=mscolab_settings.MSCOLAB_DATA_DIR)

def teardown(self):
# to disconnect connections, and clear token
# Not logging out since it pops up a dialog
# self.window.logout()
if self.window.version_window:
self.window.version_window.close()
if self.window.conn:
self.window.conn.disconnect()
# self.window.mscolab.logout()
if self.window.mscolab.version_window:
self.window.mscolab.version_window.close()
if self.window.mscolab.conn:
self.window.mscolab.conn.disconnect()
self.application.quit()
QtWidgets.QApplication.processEvents()
self.process.terminate()
Expand All @@ -80,14 +79,13 @@ def setup(self):
self.process, self.url, self.app, _, self.cm, self.fm = mscolab_start_server(PORTS, mscolab_settings)
QtTest.QTest.qWait(100)
self.application = QtWidgets.QApplication(sys.argv)
self.window = MSSMscolabWindow(data_dir=mscolab_settings.MSCOLAB_DATA_DIR,
mscolab_server_url=self.url)
self.window = mss_pyui.MSSMainWindow(mscolab_data_dir=mscolab_settings.MSCOLAB_DATA_DIR)

def teardown(self):
if self.window.version_window:
self.window.version_window.close()
if self.window.conn:
self.window.conn.disconnect()
if self.window.mscolab.version_window:
self.window.mscolab.version_window.close()
if self.window.mscolab.conn:
self.window.mscolab.conn.disconnect()
self.application.quit()
QtWidgets.QApplication.processEvents()
self.process.terminate()
Expand Down
13 changes: 6 additions & 7 deletions mslib/mscolab/_tests/test_sockets.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@

from PyQt5 import QtWidgets, QtTest
from mslib.mscolab.conf import mscolab_settings
from mslib.msui.mscolab import MSSMscolabWindow
from mslib._tests.utils import mscolab_start_server
import mslib.msui.mss_pyui as mss_pyui


PORTS = list(range(9521, 9540))
Expand All @@ -51,17 +51,16 @@ def setup(self):
self.process, self.url, self.app, _, self.cm, self.fm = mscolab_start_server(PORTS)
QtTest.QTest.qWait(500)
self.application = QtWidgets.QApplication(sys.argv)
self.window = MSSMscolabWindow(data_dir=mscolab_settings.MSCOLAB_DATA_DIR,
mscolab_server_url=self.url)
self.window = mss_pyui.MSSMainWindow(mscolab_data_dir=mscolab_settings.MSCOLAB_DATA_DIR)
self.sockets = []

def teardown(self):
for socket in self.sockets:
socket.disconnect()
if self.window.version_window:
self.window.version_window.close()
if self.window.conn:
self.window.conn.disconnect()
if self.window.mscolab.version_window:
self.window.mscolab.version_window.close()
if self.window.mscolab.conn:
self.window.mscolab.conn.disconnect()
self.application.quit()
QtWidgets.QApplication.processEvents()
self.process.terminate()
Expand Down
13 changes: 6 additions & 7 deletions mslib/mscolab/_tests/test_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
from PyQt5 import QtWidgets, QtTest
from mslib.mscolab.server import check_login, register_user
from mslib.mscolab.conf import mscolab_settings
from mslib.msui.mscolab import MSSMscolabWindow
from mslib._tests.utils import mscolab_start_server
import mslib.msui.mss_pyui as mss_pyui


PORTS = list(range(9541, 9560))
Expand All @@ -46,14 +46,13 @@ def setup(self):
self.process, self.url, self.app, _, self.cm, self.fm = mscolab_start_server(PORTS)
QtTest.QTest.qWait(500)
self.application = QtWidgets.QApplication(sys.argv)
self.window = MSSMscolabWindow(data_dir=mscolab_settings.MSCOLAB_DATA_DIR,
mscolab_server_url=self.url)
self.window = mss_pyui.MSSMainWindow(mscolab_data_dir=mscolab_settings.MSCOLAB_DATA_DIR)

def teardown(self):
if self.window.version_window:
self.window.version_window.close()
if self.window.conn:
self.window.conn.disconnect()
if self.window.mscolab.version_window:
self.window.mscolab.version_window.close()
if self.window.mscolab.conn:
self.window.mscolab.conn.disconnect()
self.application.quit()
QtWidgets.QApplication.processEvents()
self.process.terminate()
Expand Down
24 changes: 11 additions & 13 deletions mslib/mscolab/_tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
from mslib.mscolab.models import User, MessageType
from mslib.mscolab.utils import get_recent_pid, get_session_id, get_message_dict, create_files, os_fs_create_dir
from mslib.mscolab.conf import mscolab_settings
from mslib.msui.mscolab import MSSMscolabWindow
from mslib._tests.utils import (mscolab_start_server, mscolab_create_project, mscolab_register_and_login,
mscolab_delete_user, mscolab_delete_all_projects)
from mslib.mscolab.server import register_user
import mslib.msui.mss_pyui as mss_pyui

PORTS = list(range(9561, 9580))

Expand Down Expand Up @@ -64,8 +64,7 @@ def setup(self):
self.process, self.url, self.app, self.sio, self.cm, self.fm = mscolab_start_server(PORTS)
QtTest.QTest.qWait(500)
self.application = QtWidgets.QApplication(sys.argv)
self.window = MSSMscolabWindow(data_dir=mscolab_settings.MSCOLAB_DATA_DIR,
mscolab_server_url=self.url)
self.window = mss_pyui.MSSMainWindow(mscolab_data_dir=mscolab_settings.MSCOLAB_DATA_DIR)

with self.app.app_context():
response = mscolab_register_and_login(self.app, self.url, 'a1a@a1a', 'a1a', 'a1a')
Expand All @@ -83,10 +82,10 @@ def teardown(self):
with self.app.app_context():
mscolab_delete_all_projects(self.app, self.url, 'a1a@a1a', 'a1a', 'a1a')
mscolab_delete_user(self.app, self.url, 'a1a@a1a', 'a1a')
if self.window.version_window:
self.window.version_window.close()
if self.window.conn:
self.window.conn.disconnect()
if self.window.mscolab.version_window:
self.window.mscolab.version_window.close()
if self.window.mscolab.conn:
self.window.mscolab.conn.disconnect()
self.application.quit()
QtWidgets.QApplication.processEvents()
self.process.terminate()
Expand Down Expand Up @@ -117,19 +116,18 @@ def setup(self):
self.process, self.url, self.app, _, self.cm, self.fm = mscolab_start_server(PORTS)
QtTest.QTest.qWait(100)
self.application = QtWidgets.QApplication(sys.argv)
self.window = MSSMscolabWindow(data_dir=mscolab_settings.MSCOLAB_DATA_DIR,
mscolab_server_url=self.url)
self.window = mss_pyui.MSSMainWindow(mscolab_data_dir=mscolab_settings.MSCOLAB_DATA_DIR)
with self.app.app_context():
register_user('sdf@s.com', 'sdf', 'sdf')
self.user = User.query.filter_by(emailid="sdf@s.com").first()

def teardown(self):
with self.app.app_context():
mscolab_delete_user(self.app, self.url, 'sdf@s.com', 'sdf')
if self.window.version_window:
self.window.version_window.close()
if self.window.conn:
self.window.conn.disconnect()
if self.window.mscolab.version_window:
self.window.mscolab.version_window.close()
if self.window.mscolab.conn:
self.window.mscolab.conn.disconnect()
self.application.quit()
QtWidgets.QApplication.processEvents()
self.process.terminate()
Expand Down
Loading