Пример #1
0
    def test_delete_not_found(self):
        """
        Test that deleting a non-existent domain raises StrongarmHttpError.

        """

        name = 'non-existent.example.com'

        responses.add(responses.DELETE, strongarm.host + Domain.endpoint + name + '/',
                      status=404)

        # Create the Domain instance manually.
        domain = Domain({'name': name})

        # Now delete the domain.
        with self.assertRaises(strongarm.StrongarmHttpError) as exp:
            domain.delete()

        self.assertEqual(len(responses.calls), 1)
        self.assertEqual(exp.exception.status_code, 404)