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))
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))
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)
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)
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)
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)