interactive bots: Improve wikipedia bot.
ADD
zulip_bots/zulip_bots/bots/wikipedia/doc.md
+# Wikipedia Bot
+
+The Wikipedia bot is a Zulip bot that will search Wikipedia
+for a provided keyword, and fetch a link to the associated
+Wikipedia article. The link is returned to the same stream
+it was @mentioned in
+
+The Wikipedia bot uses the
+[MediaWiki API](https://www.mediawiki.org/wiki/API:Main_page)
+to obtain the search results it returns
+
+Using the Wikipedia bot is as simple as mentioning @\<wikipedia-bot-name\>,
+followed by the keyword:
+
+```
+@<wikipedia-bot-name> <keyword>
+```
+
+## Setup
+
+Beyond the typical obtaining of the zuliprc file, no extra setup is required to use the Wikipedia Bot
+
+## Usage
+
+1. ```@<wikipedia-bot-name> <keyword>``` -
+fetches the link to the appropriate Wikipedia article.
+
+ * For example, `@<wikipedia-bot-name> Zulip`
+will return the link `https://en.wikipedia.org/wiki/Zulip`
+<br>
+
+2. If the keyword does not return an article link,
+the bot will respond with an error message:
+
+ `I am sorry. The search term you provided is not found`
+
+<br>
+
+3. If no keyword is provided, the bot will return the help text:
+
+ ```Please enter your message after @mention-bot```

ADD
zulip_bots/zulip_bots/bots/wikipedia/fixtures/test_status_code.json
+
+{
+ "request": {
+ "api_url":"https://en.wikipedia.org/w/api.php?action=query&list=search&srsearch=Zulip&format=json"
+ },
+ "response": {
+ "data": {
+ "status_code":404
+ },
+ "query": {
+ "search": [
+ {
+ "title":"Number sign"
+ }
+ ]
+ }
+ },
+ "response-headers":{
+ "status":404,
+ "content-type":"text/html"
+ }
+}

MODIFY
zulip_bots/zulip_bots/bots/wikipedia/test_wikipedia.py
zulip_bots/zulip_bots/bots/wikipedia/test_wikipedia.py
@@ -55,3 +55,15 @@ class TestWikipediaBot(StubBotTestCase):
bot_request = ''
bot_response = "Please enter your search term after @mention-bot"
self.verify_reply(bot_request, bot_response)
+
+ # Incorrect status code
+ bot_request = 'Zulip'
+ bot_response = None
+ with self.mock_http_conversation('test_status_code'):
+ self.verify_reply(bot_request, bot_response)
+
+ # Request Exception
+ bot_request = 'Z'
+ bot_response = None
+ with self.mock_request_exception():
+ self.verify_reply(bot_request, bot_response)

interactive bots: Improve wikipedia bot.