source: geniuswebcore/test/geniusweb/profileconnection/ProfileServerStub.py@ 76

Last change on this file since 76 was 73, checked in by Bart Vastenhouw, 3 years ago

Fix for IssueValue hashcode.

File size: 848 bytes
Line 
1import logging
2from threading import Thread
3from time import sleep
4
5from websocket_server import WebsocketServer # type:ignore
6
7
8def new_client(client, server):
9 print("client connected!")
10 with open('test/resources/jobs/jobs1.json') as f:
11 text = f.read()
12 server.send_message_to_all(text)
13
14class ProfileServerStub(Thread):
15 '''
16 Run a fake profileserver for a simple test
17 '''
18 def run(self):
19 self.server = WebsocketServer(host='127.0.0.1',port=8080,
20 loglevel=logging.INFO, key="key.pem", cert="cert.pem")
21 self.server.set_fn_new_client(new_client)
22 self.server.run_forever()
23
24 def stop(self):
25 self.server.shutdown()
26
27if __name__ == '__main__':
28 server=ProfileServerStub()
29 server.start()
30 sleep(2)
31 print("bla")
32 server.stop()
33 print("stopped")
Note: See TracBrowser for help on using the repository browser.