'''
    Biothings Query Component Common Tests
'''

import os

from nose.core import main

from biothings.tests import BiothingsTestCase


class QueryTests(BiothingsTestCase):
    ''' Test against server specified in environment variable BT_HOST
        and BT_API or MyGene.info production server V3 by default '''

    __test__ = True

    host = os.getenv("BT_HOST", "http://mygene.info")
    api = os.getenv("BT_API", "/v3")

    def test_01(self):
        ''' KWARGS CTRL Format Json '''
        self.query(q='*', size='1')

    def test_02(self):
        ''' KWARGS CTRL Format Yaml '''
        res = self.request('query?q=*&size=1&out_format=yaml').text
        assert res.startswith('max_score:')

    def test_03(self):
        ''' KWARGS CTRL Format Html '''
        res = self.request('query?q=*&size=1&out_format=html').text
        assert '<html>' in res

    def test_04(self):
        ''' KWARGS CTRL Format Msgpack '''
        res = self.request('query?q=*&size=1&out_format=msgpack').content
        self.msgpack_ok(res)


if __name__ == '__main__':
    main(defaultTest='__main__.QueryTests', argv=['', '-v'])

'''
    Biothings Query Component Common Tests
'''

import os

from nose.core import main

from biothings.tests import BiothingsTestCase


class QueryTests(BiothingsTestCase):
    ''' Test against server specified in environment variable BT_HOST
        and BT_API or MyGene.info production server V3 by default '''

    __test__ = True

    host = os.getenv("BT_HOST", "http://mygene.info")
    api = os.getenv("BT_API", "/v3")

    def test_01(self):
        ''' KWARGS CTRL Format Json '''
        self.query(q='__all__', size='1')

    def test_02(self):
        ''' KWARGS CTRL Format Yaml '''
        res = self.request('query?q=__all__&size=1&format=yaml').text
        assert res.startswith('max_score:')

    def test_03(self):
        ''' KWARGS CTRL Format Html '''
        res = self.request('query?q=__all__&size=1&format=html').text
        assert '<html>' in res

    def test_04(self):
        ''' KWARGS CTRL Format Msgpack '''
        res = self.request('query?q=__all__&size=1&format=msgpack').content
        self.msgpack_ok(res)


if __name__ == '__main__':
    main(defaultTest='__main__.QueryTests', argv=['', '-v'])

Change match all query syntax
Change match all query syntax

  '''
      Biothings Query Component Common Tests
  '''
  
  import os
  
  from nose.core import main
  
  from biothings.tests import BiothingsTestCase
  
  
  class QueryTests(BiothingsTestCase):
      ''' Test against server specified in environment variable BT_HOST
          and BT_API or MyGene.info production server V3 by default '''
  
      __test__ = True
  
      host = os.getenv("BT_HOST", "http://mygene.info")
      api = os.getenv("BT_API", "/v3")
  
      def test_01(self):
          ''' KWARGS CTRL Format Json '''
-         self.query(q='*', size='1')
+         self.query(q='__all__', size='1')
  
      def test_02(self):
          ''' KWARGS CTRL Format Yaml '''
-         res = self.request('query?q=*&size=1&out_format=yaml').text
+         res = self.request('query?q=__all__&size=1&format=yaml').text
          assert res.startswith('max_score:')
  
      def test_03(self):
          ''' KWARGS CTRL Format Html '''
-         res = self.request('query?q=*&size=1&out_format=html').text
+         res = self.request('query?q=__all__&size=1&format=html').text
          assert '<html>' in res
  
      def test_04(self):
          ''' KWARGS CTRL Format Msgpack '''
-         res = self.request('query?q=*&size=1&out_format=msgpack').content
+         res = self.request('query?q=__all__&size=1&format=msgpack').content
          self.msgpack_ok(res)
  
  
  if __name__ == '__main__':
      main(defaultTest='__main__.QueryTests', argv=['', '-v'])
  
Change match all query syntax
## Code Before:
'''
    Biothings Query Component Common Tests
'''

import os

from nose.core import main

from biothings.tests import BiothingsTestCase


class QueryTests(BiothingsTestCase):
    ''' Test against server specified in environment variable BT_HOST
        and BT_API or MyGene.info production server V3 by default '''

    __test__ = True

    host = os.getenv("BT_HOST", "http://mygene.info")
    api = os.getenv("BT_API", "/v3")

    def test_01(self):
        ''' KWARGS CTRL Format Json '''
        self.query(q='*', size='1')

    def test_02(self):
        ''' KWARGS CTRL Format Yaml '''
        res = self.request('query?q=*&size=1&out_format=yaml').text
        assert res.startswith('max_score:')

    def test_03(self):
        ''' KWARGS CTRL Format Html '''
        res = self.request('query?q=*&size=1&out_format=html').text
        assert '<html>' in res

    def test_04(self):
        ''' KWARGS CTRL Format Msgpack '''
        res = self.request('query?q=*&size=1&out_format=msgpack').content
        self.msgpack_ok(res)


if __name__ == '__main__':
    main(defaultTest='__main__.QueryTests', argv=['', '-v'])

## Instruction:
Change match all query syntax
## Code After:
'''
    Biothings Query Component Common Tests
'''

import os

from nose.core import main

from biothings.tests import BiothingsTestCase


class QueryTests(BiothingsTestCase):
    ''' Test against server specified in environment variable BT_HOST
        and BT_API or MyGene.info production server V3 by default '''

    __test__ = True

    host = os.getenv("BT_HOST", "http://mygene.info")
    api = os.getenv("BT_API", "/v3")

    def test_01(self):
        ''' KWARGS CTRL Format Json '''
        self.query(q='__all__', size='1')

    def test_02(self):
        ''' KWARGS CTRL Format Yaml '''
        res = self.request('query?q=__all__&size=1&format=yaml').text
        assert res.startswith('max_score:')

    def test_03(self):
        ''' KWARGS CTRL Format Html '''
        res = self.request('query?q=__all__&size=1&format=html').text
        assert '<html>' in res

    def test_04(self):
        ''' KWARGS CTRL Format Msgpack '''
        res = self.request('query?q=__all__&size=1&format=msgpack').content
        self.msgpack_ok(res)


if __name__ == '__main__':
    main(defaultTest='__main__.QueryTests', argv=['', '-v'])
