1 | from typing import List
|
---|
2 | import unittest
|
---|
3 | from unittest.mock import Mock
|
---|
4 |
|
---|
5 | from unitpy.GeneralTests import GeneralTests
|
---|
6 |
|
---|
7 | from geniusweb.actions.Action import Action
|
---|
8 | from geniusweb.actions.PartyId import PartyId
|
---|
9 | from geniusweb.progress.ProgressTime import ProgressTime
|
---|
10 | from geniusweb.protocol.CurrentNegoState import CurrentNegoState
|
---|
11 | from geniusweb.protocol.session.saop.SAOPSettings import SAOPSettings
|
---|
12 | from geniusweb.protocol.session.saop.SAOPState import SAOPState
|
---|
13 |
|
---|
14 |
|
---|
15 | class CurrentNegoStateTest (unittest.TestCase,GeneralTests[CurrentNegoState]):
|
---|
16 | party1 = PartyId("party1")
|
---|
17 | party2 = PartyId("party2")
|
---|
18 | actions1:List[Action] = []
|
---|
19 |
|
---|
20 | connections = [party1]
|
---|
21 | connections2 = [party1, party2]
|
---|
22 |
|
---|
23 | progresstime = Mock(ProgressTime)
|
---|
24 | settings = Mock(SAOPSettings)
|
---|
25 |
|
---|
26 | saop1 = SAOPState(actions1, connections2, progresstime,
|
---|
27 | settings)
|
---|
28 | saop2 = SAOPState(actions1, connections, progresstime,
|
---|
29 | settings)
|
---|
30 |
|
---|
31 | state1 = CurrentNegoState(saop1, 1234)
|
---|
32 | state1a = CurrentNegoState(saop1,1234)
|
---|
33 | state2 = CurrentNegoState(saop2,1234)
|
---|
34 |
|
---|
35 | def getGeneralTestData(self)->List[List[CurrentNegoState]] :
|
---|
36 | return [[self.state1, self.state1a],[self.state2]]
|
---|
37 |
|
---|
38 | def getGeneralTestStrings(self)->List[str] :
|
---|
39 | return [
|
---|
40 | "CurrentNegoState.*1234.*SAOPState.*party1.*party2.*ProgressTime.*SAOPSettings.*",
|
---|
41 | "CurrentNegoState.*1234.*SAOPState.*party1.*ProgressTime.*SAOPSettings.*"]
|
---|
42 |
|
---|