Пример #1
3
    def test_remove_ticket(self):
        imagetickets.remove_ticket("uuid")
        expected = [
            ("request", ("DELETE", "/tickets/uuid"), {"body": None}),
        ]

        self.assertEqual(imagetickets.uhttp.__calls__, expected)
        self.assertTrue(imagetickets.uhttp.closed)
Пример #2
3
    def test_res_read_error(self):
        imagetickets.uhttp.response.status = 300
        err_msg = "Environment error message"

        def read(amt=None):
            raise EnvironmentError(err_msg)

        imagetickets.uhttp.response.read = read

        try:
            imagetickets.remove_ticket("uuid")
        except se.ImageDaemonError as e:
            self.assertTrue(err_msg in e.value)
Пример #3
1
 def test_image_daemon_error_ret(self):
     imagetickets.uhttp.response = FakeResponse(
         status=300, data=u'{"image_daemon_message":"content"}')
     try:
         imagetickets.remove_ticket("uuid")
     except se.ImageDaemonError as e:
         self.assertTrue("image_daemon_message=content" in e.value)
Пример #4
1
 def test_res_invalid_json_ret(self):
     imagetickets.uhttp.response = FakeResponse(
         status=300, data=u"not a json string")
     with self.assertRaises(se.ImageDaemonError):
         imagetickets.remove_ticket("uuid")
Пример #5
1
 def test_res_header_error(self):
     imagetickets.uhttp.response = FakeResponse(
         status=300, headers={"content-length": "invalid"})
     with self.assertRaises(se.ImageDaemonError):
         imagetickets.remove_ticket("uuid")
Пример #6
0
 def test_image_daemon_error_ret(self):
     imagetickets.uhttp.response = FakeResponse(
         status=300, data=u'{"image_daemon_message":"content"}')
     try:
         imagetickets.remove_ticket("uuid")
     except se.ImageDaemonError as e:
         self.assertTrue("image_daemon_message=content" in e.value)
Пример #7
0
    def test_remove_ticket(self):
        imagetickets.remove_ticket("uuid")
        expected = [
            ("request", ("DELETE", "/tickets/uuid"), {
                "body": None
            }),
        ]

        self.assertEqual(imagetickets.uhttp.__calls__, expected)
        self.assertTrue(imagetickets.uhttp.closed)
Пример #8
0
    def test_res_read_error(self):
        imagetickets.uhttp.response.status = 300
        err_msg = "Environment error message"

        def read(amt=None):
            raise EnvironmentError(err_msg)

        imagetickets.uhttp.response.read = read

        try:
            imagetickets.remove_ticket("uuid")
        except se.ImageDaemonError as e:
            self.assertTrue(err_msg in e.value)
Пример #9
0
 def test_res_invalid_json_ret(self):
     imagetickets.uhttp.response = FakeResponse(status=300,
                                                data=u"not a json string")
     with self.assertRaises(se.ImageDaemonError):
         imagetickets.remove_ticket("uuid")
Пример #10
0
 def test_res_header_error(self):
     imagetickets.uhttp.response = FakeResponse(
         status=300, headers={"content-length": "invalid"})
     with self.assertRaises(se.ImageDaemonError):
         imagetickets.remove_ticket("uuid")