# This file was generated by liblab | https://liblab.com/

import unittest
import responses
from src.toolhouse.net.http_client import HTTPClient
from http_exceptions import ClientException
from src.toolhouse.services.tools import Tools


class TestTools_(unittest.TestCase):
    def test_true(self):
        self.assertTrue(True)

    @responses.activate
    def test_get_tools(self):
        # Mock the API response
        responses.post("http://api.example.com/get_tools", json={}, status=200)
        # call the method to test
        test_service = Tools("testkey")
        response = test_service.get_tools("openai")
        self.assertEqual(response, {})
        responses.reset(),

    @responses.activate
    def test_get_tools_required_fields_missing(self):
        # Mock the API response
        responses.post("http://api.example.com/get_tools", json={}, status=202)
        with self.assertRaises(TypeError):
            test_service = Tools("testkey")
            test_service.get_tools()
        responses.reset(),

    @responses.activate
    def test_get_tools_error_on_non_200(self):
        # Mock the API response
        responses.post("http://api.example.com/get_tools", json={}, status=404)
        with self.assertRaises(ClientException):
            test_service = Tools("testkey")
            test_service.get_tools("openai")
        responses.reset()

    @responses.activate
    def test_run_tools(self):
        # Mock the API response
        responses.post("http://api.example.com/run_tools", json={}, status=200)
        # call the method to test
        test_service = Tools("testkey")
        response = test_service.run_tools({})
        self.assertEqual(response, {})
        responses.reset(),

    @responses.activate
    def test_run_tools_error_on_non_200(self):
        # Mock the API response
        responses.post("http://api.example.com/run_tools", json={}, status=404)
        with self.assertRaises(ClientException):
            test_service = Tools("testkey")
            test_service.run_tools({})
        responses.reset()


if __name__ == "__main__":
    unittest.main()
