Beispiel #1
0
    def test_smoke_namedtuple(self, *args):
        self.result1['icon'] = api.Icon(**self.icon1)
        self.result2['icon'] = api.Icon(**self.icon2)

        self.related_topic['topics'] = [
            api.Result(**self.result1),
            api.Result(**self.result2)]

        self.response['related_topics'] = [
            api.Result(**self.result1),
            api.Result(**self.result2),
            api.RelatedTopic(**self.related_topic)]

        expected = api.Response(**self.response)
        resp = query('python')
        self.assertEqual(resp, expected)
Beispiel #2
0
 def test_https_connection_used(self, conn, *args):
     query('anything', secure=True)
     conn.assert_called_once_with(api.SERVER_HOST)
Beispiel #3
0
 def test_json_response_as_list(self, *args):
     res = query('anything!')
     self.assertEqual(res, [1, 'x', True])
Beispiel #4
0
 def test_python3_utf8_decode(self, *args):
     # Not relevant to Python 2.
     if not is_python2():
         query('python', container='dict')
Beispiel #5
0
 def test_smoke_dict(self, *args):
     self.related_topic['topics'] = [self.result1, self.result2]
     self.response['related_topics'] = [
         self.result1, self.result2, self.related_topic]
     resp = query('python', container='dict')
     self.assertTrue(resp == self.response)