コード例 #1
0
 def test_make_search_request(self):
     with mock.patch.object(main, 'kgsearch'):
         entities = main.kgsearch.entities.return_value
         search = entities.search.return_value
         search.execute.return_value = example_response
         message = main.make_search_request('lion')
     # Just make sure there's a result.
     assert 'title' in message['attachments'][0]
     assert message['attachments'][0]['color'] == '#3367d6'
コード例 #2
0
    def test_make_search_request(self):
        with mock.patch.object(main, 'kgsearch'):
            entities = main.kgsearch.entities.return_value
            search = entities.search.return_value
            search.execute.return_value = example_response
            message = main.make_search_request('lion')

        assert 'lion' in message['text'].lower()
        assert 'lion' in message['attachments'][0]['title'].lower()
        assert message['attachments'][0]['color'] == '#3367d6'
コード例 #3
0
    def test_make_search_request(self):
        with mock.patch.object(main, 'kgsearch'):
            entities = main.kgsearch.entities.return_value
            search = entities.search.return_value
            search.execute.return_value = example_response
            message = main.make_search_request('lion')

        assert 'lion' in message['text'].lower()
        assert 'lion' in message['attachments'][0]['title'].lower()
        assert message['attachments'][0]['color'] == '#3367d6'