source: geniuswebcore/test/geniusweb/inform/ActionDoneTest.py@ 100

Last change on this file since 100 was 100, checked in by ruud, 14 months ago

python installs also wheel to avoid error messages

File size: 1.6 KB
Line 
1import unittest
2
3from pyson.ObjectMapper import ObjectMapper
4
5from geniusweb.actions.EndNegotiation import EndNegotiation
6from geniusweb.actions.PartyId import PartyId
7from geniusweb.inform.ActionDone import ActionDone
8from geniusweb.inform.Inform import Inform
9from geniusweb.inform.YourTurn import YourTurn
10from geniusweb.inform.Voting import Voting
11from unitpy.GeneralTests import GeneralTests
12from geniusweb.profileconnection import ProfileConnectionFactory
13from typing import List
14import json
15
16
17class ActionDoneTest(unittest.TestCase, GeneralTests[ActionDone]):
18
19 pyson = ObjectMapper()
20 id1 = PartyId("party1")
21 id2 = PartyId("party2")
22
23 act1 = EndNegotiation(id1)
24 act2 = EndNegotiation(id2)
25
26 done1 = ActionDone(act1)
27 done1a = ActionDone(act1)
28 done2 = ActionDone(act2)
29
30 actiondonejson = {"ActionDone":{"action":{"EndNegotiation":{"actor":"party1"}}}}
31
32 def getGeneralTestData(self) -> List[List[ActionDone]]:
33 return [[self.done1, self.done1a], [self.done2]]
34
35 def getGeneralTestStrings(self) -> List[str]:
36 return ["ActionDone.*EndNegotiation.*party1.*",
37 "ActionDone.*EndNegotiation.*party2.*"]
38
39 def testSerializeAccept(self):
40 json1 = self.pyson.toJson(self.done1)
41 print(json1)
42 self.assertEqual(self.actiondonejson, json1)
43
44 def testDeserialize(self):
45 self.assertEqual(self.done1, self.pyson.parse(self.actiondonejson, Inform))
46
47 def testGet(self):
48 self.assertEqual(self.act1, self.done1.getAction())
49
50
51
Note: See TracBrowser for help on using the repository browser.