コード例 #1
0
    def test_should_override_debug(self):

        old_debug = settings.DEBUG
        new_debug = not old_debug
        with override_settings(DEBUG=new_debug):
            self.assertEqual(settings.DEBUG, new_debug)
        self.assertEqual(settings.DEBUG, old_debug)
コード例 #2
0
    def test_should_return_empty_url_on_django_driver(self):
        with override_settings(TEST_DRIVER='django'):
            reload_module(smarttest.testcases)

            smarttest.testcases.SplinterTestCase.runTest = Mock()
            obj = smarttest.testcases.SplinterTestCase()
            result = obj.get_host()
            self.assertEqual(result, '')
コード例 #3
0
    def test_should_return_live_server_url_on_firefox_driver(self):
        with override_settings(TEST_DRIVER='firefox'):
            reload_module(smarttest.testcases)

            smarttest.testcases.SplinterTestCase.runTest = Mock()
            obj = smarttest.testcases.SplinterTestCase()
            host = 'localhost'
            port = '8081'
            obj.server_thread = Mock(host=host, port=port)
            result = obj.get_host()
            self.assertEqual(result, 'http://%s:%s' % (host, port))