Beispiel #1
0
 def setUpClass(cls):
     for arg in sys.argv:
         if "liveserver" in arg:
             cls.server_url = "http://" + arg.split("=")[1]
             return
     LiveServerTestCase.setUpClass()
     cls.server_url = cls.live_server_url
Beispiel #2
0
    def tearDownClass(cls):
        """
        Remove the temporary directory.

        """
        cls.temp_dir.cleanup()
        LiveServerTestCase.tearDownClass()
Beispiel #3
0
 def setUpClass(cls):
     for arg in sys.argv:
         if 'liveserver' in arg:
             cls.server_url = 'http://' + arg.split('=')[1]
             return
     LiveServerTestCase.setUpClass()
     cls.server_url = cls.live_server_url
Beispiel #4
0
 def setUpClass(cls):
     for arg in sys.argv:
         if "liveserver" in arg:
             cls.server_url = "http://" + arg.split("=")[1]
             return
     LiveServerTestCase.setUpClass()
     cls.server_url = cls.live_server_url
Beispiel #5
0
 def setUpClass(cls):
     for arg in sys.argv:
         if 'liveserver' in arg:
             cls.server_url = 'http://' + arg.split('=')[1]
             return
     LiveServerTestCase.setUpClass()
     cls.server_url = cls.live_server_url
Beispiel #6
0
 def setUpClass(cls):
     for arg in sys.argv:
         if 'liveserver' in arg:
             cls.server_url = "http://" + arg.split("=")[1]
             return
     LiveServerTestCase.setUpClass()
     #cls.server_url = cls.live_server_url
     cls.server_url = "http://127.0.0.1:8081/"
Beispiel #7
0
 def setUpClass(cls):
     for arg in sys.argv:
         if 'liveserver' in arg:
             cls.server_url = 'http://' + arg.split('=')[1]
             fixtures = []   #no fixtures for testing liveserver staging
             return
     LiveServerTestCase.setUpClass()
     cls.server_url = cls.live_server_url
Beispiel #8
0
 def setUpClass(cls):
     for arg in sys.argv:
         if 'liveserver' in arg:
             cls.server_url = 'http://' + arg.split('=')[1]
             fixtures = []  #no fixtures for testing liveserver staging
             return
     LiveServerTestCase.setUpClass()
     cls.server_url = cls.live_server_url
Beispiel #9
0
    def tearDown(self):

        from django.conf import settings

        for searcher in get_available_search_engines():
            searcher.clear_cache()
        shutil.rmtree(settings.WIRECLOUD_INDEX_DIR, ignore_errors=True)

        LiveServerTestCase.tearDown(self)
    def tearDown(self):

        from django.conf import settings

        for searcher in get_available_search_engines():
            searcher.clear_cache()
        shutil.rmtree(settings.WIRECLOUD_INDEX_DIR, ignore_errors=True)

        LiveServerTestCase.tearDown(self)
Beispiel #11
0
 def setUp(self):
     LiveServerTestCase.setUp(self)
     from selenium import webdriver
     mobile_emulation = { 
         #"deviceName": "Apple iPhone 3GS"
         #"deviceName": "Apple iPhone 4"
         "deviceName": "Apple iPhone 5"
         #"deviceName": "Apple iPhone 6"
         #"deviceName": "Apple iPhone 6 Plus"
         #"deviceName": "BlackBerry Z10"
         #"deviceName": "BlackBerry Z30"
         #"deviceName": "Google Nexus 4"
         #"deviceName": "Google Nexus 5"
         #"deviceName": "Google Nexus S"
         #"deviceName": "HTC Evo, Touch HD, Desire HD, Desire"
         #"deviceName": "HTC One X, EVO LTE"
         #"deviceName": "HTC Sensation, Evo 3D"
         #"deviceName": "LG Optimus 2X, Optimus 3D, Optimus Black"
         #"deviceName": "LG Optimus G"
         #"deviceName": "LG Optimus LTE, Optimus 4X HD" 
         #"deviceName": "LG Optimus One"
         #"deviceName": "Motorola Defy, Droid, Droid X, Milestone"
         #"deviceName": "Motorola Droid 3, Droid 4, Droid Razr, Atrix 4G, Atrix 2"
         #"deviceName": "Motorola Droid Razr HD"
         #"deviceName": "Nokia C5, C6, C7, N97, N8, X7"
         #"deviceName": "Nokia Lumia 7X0, Lumia 8XX, Lumia 900, N800, N810, N900"
         #"deviceName": "Samsung Galaxy Note 3"
         #"deviceName": "Samsung Galaxy Note II"
         #"deviceName": "Samsung Galaxy Note"
         #"deviceName": "Samsung Galaxy S III, Galaxy Nexus"
         #"deviceName": "Samsung Galaxy S, S II, W"
         #"deviceName": "Samsung Galaxy S4"
         #"deviceName": "Sony Xperia S, Ion"
         #"deviceName": "Sony Xperia Sola, U"
         #"deviceName": "Sony Xperia Z, Z1"
         #"deviceName": "Amazon Kindle Fire HDX 7″"
         #"deviceName": "Amazon Kindle Fire HDX 8.9″"
         #"deviceName": "Amazon Kindle Fire (First Generation)"
         #"deviceName": "Apple iPad 1 / 2 / iPad Mini"
         #"deviceName": "Apple iPad 3 / 4"
         #"deviceName": "BlackBerry PlayBook"
         #"deviceName": "Google Nexus 10"
         #"deviceName": "Google Nexus 7 2"
         #"deviceName": "Google Nexus 7"
         #"deviceName": "Motorola Xoom, Xyboard"
         #"deviceName": "Samsung Galaxy Tab 7.7, 8.9, 10.1"
         #"deviceName": "Samsung Galaxy Tab"
         #"deviceName": "Notebook with touch"
         
         # Or specify a specific build using the following two arguments
         #"deviceMetrics": { "width": 360, "height": 640, "pixelRatio": 3.0 },
         #"userAgent": "Mozilla/5.0 (Linux; Android 4.2.1; en-us; Nexus 5 Build/JOP40D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19" }
     }
     chrome_options = webdriver.ChromeOptions()
     chrome_options.add_experimental_option("mobileEmulation", mobile_emulation)
     self.browser = webdriver.Chrome(chrome_options=chrome_options)
Beispiel #12
0
 def setUpClass(cls):
     for arg in sys.argv:
         # 			print( "sys argv is " + arg)
         if 'liveserver' in arg:
             cls.server_url = 'http://' + arg.split('=')[1]
             print("overrided server url: %s " % (cls.server_url, ))
             return
     LiveServerTestCase.setUpClass()
     # 		print( "setting cls.server_url")
     cls.server_url = cls.live_server_url
 def setUpClass(cls):
     for arg in sys.argv:
         if "liveserver" in arg:
             cls.server_host = arg.split("=")[1]
             cls.server_url = "http://" + cls.server_host
             cls.against_staging = True
             return
     LiveServerTestCase.setUpClass()
     cls.against_staging = False
     cls.server_url = cls.live_server_url
Beispiel #14
0
	def setUpClass(cls):
		"""
		this methos allow run test using:
		manage.py test functional_tests --liveserver=my-staging-server.com
		"""
		for arg in sys.argv:
			if 'liveserver' in arg:
				cls.server_url = 'http://' + arg.split('=')[1]
				return
		LiveServerTestCase.setUpClass()
		cls.server_url = cls.live_server_url
Beispiel #15
0
    def setUpClass(cls):
        """ Initialize test client environment for all tests """

        for arg in sys.argv:
            if 'liveserver' in arg:
                cls.server_url = 'http://' + arg.split('=')[1]

                return

        LiveServerTestCase.setUpClass()
        cls.server_url = cls.live_server_url
Beispiel #16
0
 def setUpClass(cls):
     # Run command ./manage.py test functional_tests /
     # --liveserver=superlists-staging.ottg.eu
     for arg in sys.argv:
         if 'liveserver' in arg:
             cls.server_host = arg.split('=')[1]
             cls.server_url = 'http://' + cls.server_host
             cls.against_staging = True
             return
     LiveServerTestCase.setUpClass()
     cls.against_staging = False
     cls.server_url = cls.live_server_url
Beispiel #17
0
 def __init__(self, *args, **kwargs):
     dirs = os.listdir(tests_dir)
     test_numbers = []
     for dir in dirs:
         try:
             test_number = int(dir)
             test_numbers.append(test_number)
         except:
             pass
     self.test_dir = tests_dir + '/{}'.format(len(test_numbers))
     os.makedirs(self.test_dir)
     self.log_filepath = self.test_dir + '/{}'.format(self.log_filename)
     self.error_log_filepath = self.test_dir + '/{}'.format(self.error_log_filename)
     LiveServerTestCase.__init__(self, *args, **kwargs)
    def setUp(self):

        from django.core.cache import cache

        restoretree(self.localcatalogue_tmp_dir_backup, self.localcatalogue_tmp_dir)
        restoretree(self.catalogue_tmp_dir_backup, self.catalogue_tmp_dir)
        cache.clear()
        try:
            self.network._servers['http']['example.com'].clear()
        except:
            pass

        LiveServerTestCase.setUp(self)
        WirecloudRemoteTestCase.setUp(self)
Beispiel #19
0
    def tearDown(self):

        from django.conf import settings
        if self.clear_search_indexes:
            management.call_command('clear_index', interactive=False, verbosity=0)

            # Reload the connection
            haystack.connections.connections_info = settings.HAYSTACK_CONNECTIONS
            haystack.connections.reload('default')

            time.sleep(0.2)

        LiveServerTestCase.tearDown(self)
        WirecloudRemoteTestCase.tearDown(self)
 def start_liveserver_if_needed(cls):
     cls.liveserver_url = None
     for api_cls in cls.get_test_api_classes():
         if not getattr(api_cls, 'needs_live_server', False):
             continue
         if cls.liveserver_url is None:
             LiveServerTestCase.setUpClass()
             cls.selenium = WebDriver()
             # inlined from LiveServerTestCase
             cls.liveserver_url = 'http://%s:%s' % (
                 LiveServerTestCase.server_thread.host, LiveServerTestCase.server_thread.port)
         api_cls.server_thread = LiveServerTestCase.server_thread
         api_cls.selenium = cls.selenium
         api_cls.liveserver_url = cls.liveserver_url
     cls.has_liveserver = cls.liveserver_url is not None
Beispiel #21
0
 def __init__(self, *args, **kwargs):
     dirs = os.listdir(tests_dir)
     test_numbers = []
     for dir in dirs:
         try:
             test_number = int(dir)
             test_numbers.append(test_number)
         except:
             pass
     self.test_dir = tests_dir + '/{}'.format(len(test_numbers))
     os.makedirs(self.test_dir)
     self.log_filepath = self.test_dir + '/{}'.format(self.log_filename)
     self.error_log_filepath = self.test_dir + '/{}'.format(
         self.error_log_filename)
     LiveServerTestCase.__init__(self, *args, **kwargs)
Beispiel #22
0
 def setUpClass(cls):
     cls.display = None
     try:
         display = Display(visible=0, size=(1024, 768))
         display.start()
     except:
         pass
     for arg in sys.argv:
         if 'liveserver' in arg:
             cls.server_url = 'http://' + arg.split('=')[1]
             return
     cls.browser = webdriver.Firefox()
     cls.browser.implicitly_wait(5)
     LiveServerTestCase.setUpClass()
     cls.server_url = cls.live_server_url
Beispiel #23
0
    def setUp(self):

        from django.core.cache import cache

        restoretree(self.localcatalogue_tmp_dir_backup,
                    self.localcatalogue_tmp_dir)
        restoretree(self.catalogue_tmp_dir_backup, self.catalogue_tmp_dir)
        cache.clear()
        try:
            self.network._servers['http']['example.com'].clear()
        except:
            pass

        LiveServerTestCase.setUp(self)
        WirecloudRemoteTestCase.setUp(self)
Beispiel #24
0
 def setUpClass(cls):
     cls.display = None
     try:
         display = Display(visible=0, size=(1024, 768))
         display.start()
     except:
         pass
     for arg in sys.argv:
         if 'liveserver' in arg:
             cls.server_url = 'http://' + arg.split('=')[1]
             return
     cls.browser = webdriver.Firefox()
     cls.browser.implicitly_wait(5)
     LiveServerTestCase.setUpClass()
     cls.server_url = cls.live_server_url
Beispiel #25
0
    def tearDown(self):

        from django.conf import settings
        if self.clear_search_indexes:
            management.call_command('clear_index',
                                    interactive=False,
                                    verbosity=0)

            # Reload the connection
            haystack.connections.connections_info = settings.HAYSTACK_CONNECTIONS
            haystack.connections.reload('default')

            time.sleep(0.2)

        LiveServerTestCase.tearDown(self)
        WirecloudRemoteTestCase.tearDown(self)
Beispiel #26
0
    def setUp(self):

        from django.core.cache import cache

        restoretree(self.localcatalogue_tmp_dir_backup,
                    self.localcatalogue_tmp_dir)
        restoretree(self.catalogue_tmp_dir_backup, self.catalogue_tmp_dir)
        cache.clear()
        try:
            self.network._servers['http']['example.com'].clear()
        except:
            pass

        LiveServerTestCase.setUp(self)
        WirecloudRemoteTestCase.setUp(self)
        management.call_command('populate', verbosity=0, interactive=False)
Beispiel #27
0
    def setUp(self):

        haystack.connections.reload('default')
        management.call_command('rebuild_index', interactive=False, verbosity=0)

        from django.core.cache import cache

        restoretree(self.localcatalogue_tmp_dir_backup, self.localcatalogue_tmp_dir)
        restoretree(self.catalogue_tmp_dir_backup, self.catalogue_tmp_dir)
        cache.clear()
        try:
            self.network._servers['http']['example.com'].clear()
        except:
            pass

        LiveServerTestCase.setUp(self)
        WirecloudRemoteTestCase.setUp(self)
        management.call_command('populate', verbosity=0, interactive=False)
Beispiel #28
0
    def run(self, result=None):
        res = LiveServerTestCase.run(self, result=result)

        # save screenshot of an error or failure
        if res.errors:
            self.__make_screenshot(res.errors, "Error")
        if res.failures:
            self.__make_screenshot(res.failures, "Failure")

        return res
Beispiel #29
0
    def setUpClass(cls):
        """
        Creates a temporary directory containing TypeScript package source files,
        and then runs `npm install`.


        """
        LiveServerTestCase.setUpClass()
        cls.temp_dir = tempfile.TemporaryDirectory()
        # Setup the TypeScript package files.
        shutil.copy2(PACKAGE_JSON, cls.temp_dir.name)
        shutil.copy2(TSCONFIG_JSON, cls.temp_dir.name)
        shutil.copy2(TSCONFIG_MODULE_JSON, cls.temp_dir.name)
        # Make the source directory and create 'index.js'.
        cls.app_src_path = os.path.join(cls.temp_dir.name, 'src')
        os.mkdir(cls.app_src_path)
        shutil.copy2(INDEX_JS, cls.app_src_path)
        # Install the package
        subprocess.check_call(['npm', 'install'], cwd=cls.temp_dir.name)
Beispiel #30
0
    def setUp(self):

        haystack.connections.reload('default')
        management.call_command('rebuild_index',
                                interactive=False,
                                verbosity=0)

        from django.core.cache import cache

        restoretree(self.localcatalogue_tmp_dir_backup,
                    self.localcatalogue_tmp_dir)
        restoretree(self.catalogue_tmp_dir_backup, self.catalogue_tmp_dir)
        cache.clear()
        try:
            self.network._servers['http']['example.com'].clear()
        except Exception:
            pass

        LiveServerTestCase.setUp(self)
        WirecloudRemoteTestCase.setUp(self)
        management.call_command('populate', verbosity=0, interactive=False)
Beispiel #31
0
 def tearDownClass(cls):
     if cls.server_url == cls.live_server_url:
         LiveServerTestCase.tearDownClass()
Beispiel #32
0
 def run_live_server_thread(self, connections_override=None):
     thread = LiveServerTestCase._create_server_thread(connections_override)
     thread.daemon = True
     thread.start()
     thread.is_ready.wait()
     thread.terminate()
Beispiel #33
0
 def _post_teardown(self):
     LiveServerTestCase._post_teardown(self)
     time.sleep(1)
     self.sett.disable()
Beispiel #34
0
 def _pre_setup(self):
     LiveServerTestCase._pre_setup(self)
     self.sett = self.settings(MIDDLEWARE_CLASSES=global_settings.MIDDLEWARE_CLASSES,
         TEMPLATE_DIRS=[TEST_TEMPLATES_DIR])
     self.sett.enable()
 def run_live_server_thread(self, connections_override=None):
     thread = LiveServerTestCase._create_server_thread(connections_override)
     thread.daemon = True
     thread.start()
     thread.is_ready.wait()
     thread.terminate()
Beispiel #36
0
 def tearDownClass(cls):
     cls.browser.quit()
     if cls.display:
         cls.display.stop()
     if cls.server_url == cls.live_server_url:
         LiveServerTestCase.tearDownClass()
Beispiel #37
0
 def _pre_setup(self):
     LiveServerTestCase._pre_setup(self)
     self.sett = self.settings(**SETTINGS)
     self.sett.enable()
Beispiel #38
0
 def tearDownClass(cls):
     """docstring for tearDownClass"""
     if cls.server_url == cls.live_server_url:
         LiveServerTestCase.tearDownClass()
Beispiel #39
0
 def setUpClass(cls):
     cls.driver = WebDriver()
     LiveServerTestCase.setUpClass()
Beispiel #40
0
 def tearDownClass(cls):
     if cls.server_url == cls.live_server_url:
         LiveServerTestCase.tearDownClass()
Beispiel #41
0
    def tearDownClass(cls):
        """ Cleanup test client environment after all tests """

        if cls.server_url == cls.live_server_url:
            LiveServerTestCase.tearDownClass()
Beispiel #42
0
 def tearDownClass(cls):
     if not cls.against_staging:
         LiveServerTestCase.tearDownClass()
Beispiel #43
0
 def tearDown(self):
     self.browser.quit()
     LiveServerTestCase.tearDown(self)
 def stop_liveserver_if_needed(cls):
     if cls.has_liveserver:
         LiveServerTestCase.tearDownClass()
         cls.selenium.quit()
Beispiel #45
0
    def tearDownClass(cls):
        """ Cleanup global test/live test environment """

        if cls.server_url == cls.live_server_url:
            LiveServerTestCase.tearDownClass()
Beispiel #46
0
 def tearDownClass(cls):
     LiveServerTestCase.tearDownClass()
     cls.browser.quit()
Beispiel #47
0
 def setUpClass(cls):
     LiveServerTestCase.setUpClass()
     cls.browser = getattr(webdriver, os.environ.get('TEST_BROWSER', 'Firefox'))()
     cls.browser.implicitly_wait(5)
Beispiel #48
0
 def tearDownClass(cls):
     cls.browser.quit()
     if cls.display:
         cls.display.stop()
     if cls.server_url == cls.live_server_url:
         LiveServerTestCase.tearDownClass()
Beispiel #49
0
 def tearDownClass(cls):
     #if cls.server_url == cls.live_server_url:
     if cls.server_url == "http://127.0.0.1:8081/":
         LiveServerTestCase.tearDownClass()
Beispiel #50
0
 def tearDownClass(cls):
     cls.driver.quit()
     LiveServerTestCase.tearDownClass()