source: geniuswebcore/test/geniusweb/actions/EndNegotiationTest.py@ 88

Last change on this file since 88 was 88, checked in by Bart Vastenhouw, 2 years ago

Added python SimpleRunner GUI

File size: 1.0 KB
Line 
1from decimal import Decimal
2import unittest
3
4from pyson.ObjectMapper import ObjectMapper
5
6from geniusweb.actions.Action import Action
7from geniusweb.actions.EndNegotiation import EndNegotiation
8from geniusweb.actions.PartyId import PartyId
9
10
11class OfferTest (unittest.TestCase) :
12 actor=PartyId("myid")
13 actor2=PartyId("otherid")
14 endnego=EndNegotiation(actor)
15 endnego1=EndNegotiation(actor)
16 endnego2=EndNegotiation(actor2)
17
18 pyson=ObjectMapper()
19
20 def testSerialize(self):
21 self.assertEqual({'EndNegotiation': {'actor': 'myid'}}, self.pyson.toJson(self.endnego))
22
23 def testDeserialize(self):
24 jsonenego= self.pyson.toJson(self.endnego)
25 self.assertEqual(self.endnego, self.pyson.parse(jsonenego, Action))
26
27 def testRepr(self):
28 self.assertEqual("EndNegotiation[myid]", repr(self.endnego))
29
30 def testEqual(self):
31 self.assertEqual(self.endnego, self.endnego1)
32 self.assertNotEqual(self.endnego, self.endnego2)
33 self.assertEqual(hash(self.endnego), hash(self.endnego1))
34 self.assertNotEqual(hash(self.endnego), hash(self.endnego2))
35
Note: See TracBrowser for help on using the repository browser.