source: exampleparties/timedependentparty/test/TestConnection.py@ 85

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

Added time-dependent parties for python and simpleRunner-GUI for java

File size: 1.0 KB
RevLine 
[84]1from typing import List, Optional
2from tudelft.utilities.listener.DefaultListenable import DefaultListenable
3from geniusweb.actions.Action import Action
4from geniusweb.inform.Inform import Inform
5from geniusweb.connection.ConnectionEnd import ConnectionEnd
6from geniusweb.references.Reference import Reference
7from uri.uri import URI
8
9class TestConnection(DefaultListenable[Inform], ConnectionEnd[Inform, Action]):
10 '''
11 A "real" connection object, because the party is going to subscribe etc, and
12 without a real connection we would have to do a lot of mocks that would make
13 the test very hard to read.
14 '''
15
16 def __init__(self):
17 super().__init__()
18 self.actions: List[Action] = []
19
20 #Override
21 def send(self , action:Action ):
22 self.actions.append(action)
23
24 #Override
25 def getReference(self)-> Reference :
26 return None #type:ignore
27
28 #Override
29 def getRemoteURI(self) -> URI :
30 return None #type:ignore
31
32 def close(self):
33 pass
34
35 #Override
36 def getError(self)->Optional[Exception] :
37 return None
38
39 def getActions(self) -> List[Action] :
40 return self.actions
Note: See TracBrowser for help on using the repository browser.