Last change
on this file since 80 was 73, checked in by Bart Vastenhouw, 3 years ago |
Fix for IssueValue hashcode.
|
File size:
848 bytes
|
Line | |
---|
1 | import logging
|
---|
2 | from threading import Thread
|
---|
3 | from time import sleep
|
---|
4 |
|
---|
5 | from websocket_server import WebsocketServer # type:ignore
|
---|
6 |
|
---|
7 |
|
---|
8 | def 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 |
|
---|
14 | class 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 |
|
---|
27 | if __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.