コード例 #1
0
ファイル: test_ticket.py プロジェクト: peplin/astral
 def test_delete(self):
     node = Node.me()
     ticket = TicketFactory(destination=node)
     self.http_client.fetch(HTTPRequest(
         self.get_url(ticket.absolute_url()), 'DELETE'), self.stop)
     response = self.wait()
     eq_(response.code, 200)
     eq_(Ticket.get_by(id=ticket.id), None)
     ok_(Stream.get_by(slug=ticket.stream.slug))
コード例 #2
0
 def test_delete(self):
     node = Node.me()
     ticket = TicketFactory(destination=node)
     self.http_client.fetch(
         HTTPRequest(self.get_url(ticket.absolute_url()), 'DELETE'),
         self.stop)
     response = self.wait()
     eq_(response.code, 200)
     eq_(Ticket.get_by(id=ticket.id), None)
     ok_(Stream.get_by(slug=ticket.stream.slug))
コード例 #3
0
ファイル: test_ticket.py プロジェクト: peplin/astral
 def test_confirm(self):
     node = Node.me()
     ticket = TicketFactory(destination=node, confirmed=False)
     data = {'confirmed': True}
     eq_(ticket.confirmed, False)
     self.http_client.fetch(HTTPRequest(
         self.get_url(ticket.absolute_url()), 'PUT', body=json.dumps(data)),
         self.stop)
     response = self.wait()
     eq_(response.code, 200)
     eq_(ticket.confirmed, True)
コード例 #4
0
 def test_confirm(self):
     node = Node.me()
     ticket = TicketFactory(destination=node, confirmed=False)
     data = {'confirmed': True}
     eq_(ticket.confirmed, False)
     self.http_client.fetch(
         HTTPRequest(self.get_url(ticket.absolute_url()),
                     'PUT',
                     body=json.dumps(data)), self.stop)
     response = self.wait()
     eq_(response.code, 200)
     eq_(ticket.confirmed, True)
コード例 #5
0
ファイル: test_ticket.py プロジェクト: peplin/astral
 def test_get(self):
     node = Node.me()
     ticket = TicketFactory(destination=node)
     mockito.when(TicketsAPI).create(mockito.any(),
             destination_uuid=mockito.any()).thenReturn(
                     {'source': ticket.destination.uuid,
                         'source_port': ticket.source_port,
                         'hops': ticket.hops})
     response = self.fetch(ticket.absolute_url())
     eq_(response.code, 200)
     result = json.loads(response.body)
     ok_('ticket' in result)
     eq_(result['ticket']['stream'], ticket.stream.slug)
コード例 #6
0
 def test_get(self):
     node = Node.me()
     ticket = TicketFactory(destination=node)
     mockito.when(TicketsAPI).create(
         mockito.any(), destination_uuid=mockito.any()).thenReturn({
             'source':
             ticket.destination.uuid,
             'source_port':
             ticket.source_port,
             'hops':
             ticket.hops
         })
     response = self.fetch(ticket.absolute_url())
     eq_(response.code, 200)
     result = json.loads(response.body)
     ok_('ticket' in result)
     eq_(result['ticket']['stream'], ticket.stream.slug)