Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a test for aiohttp.ClientOSError exceptions in parsers #270

Closed
jacobtomlinson opened this issue Oct 17, 2017 · 1 comment
Closed

Add a test for aiohttp.ClientOSError exceptions in parsers #270

jacobtomlinson opened this issue Oct 17, 2017 · 1 comment

Comments

@jacobtomlinson
Copy link
Member

In both the api.ai and LUIS parsers there is a try ... except block for an aiohttp.ClientOSError when contacting the API.

These lines are not covered in the tests. This needs adding.

@FabioRosado
Copy link
Member

FabioRosado commented Oct 17, 2017

While browsing stackoverflow and checking the wit.ai test cases I came up with this:

    async def test_parse_witai_clientOSError(self):
        with OpsDroid() as opsdroid:
            opsdroid.config['parsers'] = [
                {'name': 'witai', 'access-token': 'test'}
            ]
            mock_skill = amock.CoroutineMock()
            match_witai('get_weather')(mock_skill)

            with amock.patch.object(witai, 'call_witai') as mocked_call_witai:
                mocked_call_witai.raiseError.ClientOSError = ClientOSError()

            self.assertTrue(ClientOSError)

This simply raises the ClientOSError and assets it to true. Would this be something worth using for this issue or I should put more thought into it?

FabioRosado added a commit to FabioRosado/opsdroid that referenced this issue Oct 19, 2017
FabioRosado added a commit to FabioRosado/opsdroid that referenced this issue Oct 19, 2017
FabioRosado added a commit to FabioRosado/opsdroid that referenced this issue Oct 19, 2017
FabioRosado added a commit to FabioRosado/opsdroid that referenced this issue Oct 19, 2017
FabioRosado added a commit to FabioRosado/opsdroid that referenced this issue Oct 19, 2017
FabioRosado added a commit to FabioRosado/opsdroid that referenced this issue Oct 20, 2017
FabioRosado added a commit to FabioRosado/opsdroid that referenced this issue Oct 20, 2017
FabioRosado added a commit to FabioRosado/opsdroid that referenced this issue Oct 20, 2017
jacobtomlinson pushed a commit that referenced this issue Oct 20, 2017
Add tests for ClientOSError in apiai, witai and luisai parsers
FabioRosado added a commit to FabioRosado/opsdroid that referenced this issue Oct 20, 2017
Add tests for ClientOSError in apiai, witai and luisai parsers
FabioRosado added a commit to FabioRosado/opsdroid that referenced this issue Oct 20, 2017
Add tests for ClientOSError in apiai, witai and luisai parsers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants