from tornado import testing

from qotr.server import make_application
from qotr.config import config

class TestChannelHandler(testing.AsyncHTTPTestCase):
    '''
    Test the channel creation handler.
    '''

    port = None
    application = None

    def get_app(self):
        return make_application()


    def test_index(self):
        response = self.fetch('/')
        self.assertEqual(200, response.code)

    def test_channel(self):
        response = self.fetch('/c/foo')
        self.assertEqual(200, response.code)

    def test_arbitrary(self):
        response = self.fetch('/arbitrary-page')
        self.assertEqual(404, response.code)

    def test_https_redirect(self):
        _old_cfg = config.redirect_to_https
        config.redirect_to_https = True
        response = self.fetch('/c/foo', follow_redirects=False)
        config.redirect_to_https = _old_cfg
        self.assertEqual(301, response.code)

from tornado import testing

from qotr.server import make_application
from qotr.config import config

class TestChannelHandler(testing.AsyncHTTPTestCase):
    '''
    Test the channel creation handler.
    '''

    port = None
    application = None

    def get_app(self):
        return make_application()

    # def test_index(self):
    #     response = self.fetch('/')
    #     self.assertEqual(200, response.code)

    # def test_channel(self):
    #     response = self.fetch('/c/foo')
    #     self.assertEqual(200, response.code)

    # def test_arbitrary(self):
    #     response = self.fetch('/arbitrary-page')
    #     self.assertEqual(404, response.code)

    def test_https_redirect(self):
        _old_cfg = config.redirect_to_https
        config.redirect_to_https = True
        response = self.fetch('/c/foo', follow_redirects=False)
        config.redirect_to_https = _old_cfg
        self.assertEqual(301, response.code)

Disable testing for index.html, needs ember build
Disable testing for index.html, needs ember build

Signed-off-by: Rohan Jain <f3a935f2cb7c3d75d1446a19169b923809d6e623@gmail.com>

  from tornado import testing
  
  from qotr.server import make_application
  from qotr.config import config
  
  class TestChannelHandler(testing.AsyncHTTPTestCase):
      '''
      Test the channel creation handler.
      '''
  
      port = None
      application = None
  
      def get_app(self):
          return make_application()
  
+     # def test_index(self):
+     #     response = self.fetch('/')
+     #     self.assertEqual(200, response.code)
  
-     def test_index(self):
+     # def test_channel(self):
-         response = self.fetch('/')
+     #     response = self.fetch('/c/foo')
-         self.assertEqual(200, response.code)
+     #     self.assertEqual(200, response.code)
  
-     def test_channel(self):
-         response = self.fetch('/c/foo')
-         self.assertEqual(200, response.code)
- 
-     def test_arbitrary(self):
+     # def test_arbitrary(self):
-         response = self.fetch('/arbitrary-page')
+     #     response = self.fetch('/arbitrary-page')
-         self.assertEqual(404, response.code)
+     #     self.assertEqual(404, response.code)
  
      def test_https_redirect(self):
          _old_cfg = config.redirect_to_https
          config.redirect_to_https = True
          response = self.fetch('/c/foo', follow_redirects=False)
          config.redirect_to_https = _old_cfg
          self.assertEqual(301, response.code)
  
Disable testing for index.html, needs ember build
## Code Before:
from tornado import testing

from qotr.server import make_application
from qotr.config import config

class TestChannelHandler(testing.AsyncHTTPTestCase):
    '''
    Test the channel creation handler.
    '''

    port = None
    application = None

    def get_app(self):
        return make_application()


    def test_index(self):
        response = self.fetch('/')
        self.assertEqual(200, response.code)

    def test_channel(self):
        response = self.fetch('/c/foo')
        self.assertEqual(200, response.code)

    def test_arbitrary(self):
        response = self.fetch('/arbitrary-page')
        self.assertEqual(404, response.code)

    def test_https_redirect(self):
        _old_cfg = config.redirect_to_https
        config.redirect_to_https = True
        response = self.fetch('/c/foo', follow_redirects=False)
        config.redirect_to_https = _old_cfg
        self.assertEqual(301, response.code)

## Instruction:
Disable testing for index.html, needs ember build
## Code After:
from tornado import testing

from qotr.server import make_application
from qotr.config import config

class TestChannelHandler(testing.AsyncHTTPTestCase):
    '''
    Test the channel creation handler.
    '''

    port = None
    application = None

    def get_app(self):
        return make_application()

    # def test_index(self):
    #     response = self.fetch('/')
    #     self.assertEqual(200, response.code)

    # def test_channel(self):
    #     response = self.fetch('/c/foo')
    #     self.assertEqual(200, response.code)

    # def test_arbitrary(self):
    #     response = self.fetch('/arbitrary-page')
    #     self.assertEqual(404, response.code)

    def test_https_redirect(self):
        _old_cfg = config.redirect_to_https
        config.redirect_to_https = True
        response = self.fetch('/c/foo', follow_redirects=False)
        config.redirect_to_https = _old_cfg
        self.assertEqual(301, response.code)
