mirror of
https://github.com/TheGreyDiamond/Enlight.git
synced 2025-07-21 13:48:39 +02:00
tilt to node.js
This commit is contained in:
40
leagcy/testing/sessionDiscoveryTesting.py
Normal file
40
leagcy/testing/sessionDiscoveryTesting.py
Normal file
@ -0,0 +1,40 @@
|
||||
import sys
|
||||
sys.path.append('mainCode/../')
|
||||
import mainCode.session
|
||||
import unittest
|
||||
import time
|
||||
|
||||
|
||||
class SessionTesting(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.testSession = mainCode.session.enlightSession("TestSession", role = mainCode.session.HOST)
|
||||
self.testSession.initConnection()
|
||||
|
||||
def test_check_if_members_are_empty(self):
|
||||
time.sleep(1)
|
||||
members = self.testSession.getSessionMembers()
|
||||
self.assertEqual(members, [])
|
||||
|
||||
def test_if_allow_join_is_okay(self):
|
||||
time.sleep(2)
|
||||
self.assertEqual(self.testSession.allowJoin, True)
|
||||
|
||||
def test_if_var_and_func_return_same(self):
|
||||
time.sleep(3)
|
||||
self.assertEqual(self.testSession.sessionId, self.testSession.getSessionId())
|
||||
|
||||
def test_if_connection_works(self):
|
||||
self.recSession = mainCode.session.enlightSession("LocalSession", role = mainCode.session.USER)
|
||||
self.recSession.initConnection()
|
||||
time.sleep(1)
|
||||
sessnId = list(self.recSession.allOnlineSessions.keys())[0]
|
||||
print(sessnId)
|
||||
self.recSession.leave()
|
||||
self.assertEqual(self.testSession.getSessionId(), sessnId)
|
||||
|
||||
def tearDown(self):
|
||||
self.testSession.stopSession()
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
Reference in New Issue
Block a user