import requests
import urllib.parse
import sys



class Plugin:
    def on_command(self, bot, msg):
        url = None
        if len(sys.argv) >= 2:
            url = sys.argv[1]
        else:
            url = sys.stdin.read().strip()

        url = "http://isitup.org/{0}.json".format(urllib.parse.quote(url))
        headers = {"User-Agent": "SmartBot"}

        res = requests.get(url, headers=headers).json()
        if res["status_code"] == 1:
            print("{0} looks up for me.".format(res["domain"]))
        else:
            print("{0} looks down for me.".format(res["domain"]))

    def on_help(self):
        return "Usage: isup <domain>"

@@ -1,12 +1,22 @@
+import io%0A
 import reque
@@ -19,16 +19,32 @@
 equests%0A
+import unittest%0A
 import u
@@ -59,22 +59,10 @@
 rse%0A
-import sys%0A
 %0A%0A
-%0A
 clas
@@ -104,16 +104,38 @@
 bot, msg
+, stdin, stdout, reply
 ):%0A     
@@ -163,24 +163,27 @@
  if len(
-sys.argv
+msg%5B%22args%22%5D
 ) %3E= 2:%0A
@@ -204,16 +204,19 @@
 l = 
-sys.argv
+msg%5B%22args%22%5D
 %5B1%5D%0A
@@ -251,12 +251,8 @@
 l = 
-sys.
 stdi
@@ -544,16 +544,29 @@
 omain%22%5D)
+, file=stdout
 )%0A      
@@ -637,16 +637,29 @@
 omain%22%5D)
+, file=stdout
 )%0A%0A    d
@@ -714,8 +714,634 @@
 omain%3E%22%0A
+%0A%0Aclass Test(unittest.TestCase):%0A    def setUp(self):%0A        self.plugin = Plugin()%0A%0A    def test_isup(self):%0A        stdout = io.StringIO()%0A        self.plugin.on_command(None, %7B%22args%22: %5BNone, %22google.com%22%5D%7D, stdout, stdout, None)%0A        self.assertEqual(%22google.com looks up for me.%22, stdout.getvalue().strip())%0A%0A    def test_isdown(self):%0A        stdout = io.StringIO()%0A        self.plugin.on_command(None, %7B%22args%22: %5BNone, %22fsafsddsgss%22%5D%7D, stdout, stdout, None)%0A        self.assertEqual(%22fsafsddsgss looks down for me.%22, stdout.getvalue().strip())%0A%0A    def test_help(self):%0A        self.assertTrue(self.plugin.on_help())%0A

Add tests to isup plugin