Esempio n. 1
0
 def generate_ticket(self, values):
     vm = self.get_vending_machine()
     ticket_id = ticket.encode(vm.generate())
     if not os.path.exists(self.eid):
         os.makedirs(self.eid)
     with file(self.get_ticket_filename(ticket_id), 'wb') as ticket_file:
         json.dump(values, ticket_file)
     return ticket_id
Esempio n. 2
0
 def test_encode_decode(self):
     for ticket_value in TICKET_VALUES:
         encoded = ticket.encode(ticket_value)
         decoded = ticket.decode(encoded)
         self.assertEquals(ticket_value, decoded)
Esempio n. 3
0
 def g(result, i):
     result[i] = ticket.encode(ticketing.gen())
Esempio n. 4
0
 def test_encode_decode(self):
     for ticket_value in TICKET_VALUES:
         encoded = ticket.encode(ticket_value)
         decoded = ticket.decode(encoded)
         self.assertEquals(ticket_value, decoded)