Forráskód Böngészése

Add new localization arg test

Ellison Leao 11 éve
szülő
commit
571148458c
1 módosított fájl, 8 hozzáadás és 1 törlés
  1. 8 1
      test_howdoi.py

+ 8 - 1
test_howdoi.py

@@ -9,9 +9,11 @@ from howdoi import howdoi
 
 class HowdoiTestCase(unittest.TestCase):
 
-    def call_howdoi(self, query):
+    def call_howdoi(self, query, lang=None):
         parser = howdoi.get_parser()
         args = vars(parser.parse_args(query.split(' ')))
+        if lang:
+            args['lang'] = lang
         return howdoi.howdoi(args)
 
     def setUp(self):
@@ -19,6 +21,9 @@ class HowdoiTestCase(unittest.TestCase):
                         'print stack trace python',
                         'convert mp4 to animated gif',
                         'create tar archive']
+        self.pt_queries = ['abrir arquivo em python',
+                           'enviar email em django',
+                           'hello world em c']
         self.bad_queries = ['moe',
                             'mel']
 
@@ -42,6 +47,8 @@ class HowdoiTestCase(unittest.TestCase):
             self.assertTrue(self.call_howdoi(query))
         for query in self.bad_queries:
             self.assertTrue(self.call_howdoi(query))
+        for query in self.pt_queries:
+            self.assertTrue(self.call_howdoi(query, lang='pt-br'))
 
     def test_answer_links(self):
         for query in self.queries: