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

Last change on this file since 63 was 59, checked in by Wouter Pasman, 3 years ago

#44 manual commit of first public release, because this will cause the dist directory to move

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.