def test_add_ticket(self): ticket = create_ticket(uuid="uuid") body = json.dumps(ticket) expected = [ ("request", ("PUT", "/tickets/uuid"), {"body": body}), ] imagetickets.add_ticket(ticket) self.assertEqual(imagetickets.uhttp.__calls__, expected) self.assertTrue(imagetickets.uhttp.closed)
def test_image_tickets_error(self, exc_type): ticket = create_ticket(uuid="uuid") def request(method, path, body=None): raise exc_type imagetickets.uhttp.request = request with self.assertRaises(se.ImageTicketsError): imagetickets.add_ticket(ticket)
def test_add_ticket(self): ticket = create_ticket(uuid="uuid") body = json.dumps(ticket) expected = [ ("request", ("PUT", "/tickets/uuid"), { "body": body }), ] imagetickets.add_ticket(ticket) self.assertEqual(imagetickets.uhttp.__calls__, expected) self.assertTrue(imagetickets.uhttp.closed)