Beispiel #1
0
 def setUp(self):
     TestBase.setUp(self)
     self._file_name = 'good_eats.csv'
     self._file_path = 'tests/fixtures/%s' % self._file_name
     self._file_uri = 'file://%s' % self._file_path
     self.url = 'http://formhub.org/mberg/forms/good_eats/data.csv'
     self.controller = Datasets()
Beispiel #2
0
 def setUp(self):
     TestBase.setUp(self)
     self.dataset = Dataset.save(self.test_dataset_ids['good_eats.csv'])
     Dataset.build_schema(self.dataset,
             self.test_data['good_eats.csv'].dtypes)
     self.formula = 'rating'
     self.name = 'test'
Beispiel #3
0
    def setUp(self):
        TestBase.setUp(self)

        self._file = 'file://tests/fixtures/good_eats.csv'
        self.dataset_id = create_dataset_from_url(self._file,
                allow_local_file=True)[ID]
        self.controller = Calculations()
        self.formula = 'amount + gps_alt'
        self.name = 'test'
    def __init__(self,
                 email=TestBase.data()['existing_login'],
                 password=TestBase.data()['existing_password']):

        if email == None:
            self._email = TestBase.data()['existing_login']
        else:
            self._email = email
        if password == None:
            self._password = TestBase.data()['existing_password']
        elif password == "WRONG":
            self._password = TestBase.data()['not_existing_password']
        else:
            self._password = password
Beispiel #5
0
    def test_login_success(self, driver):
        welcome_page = WelcomePage(driver)
        login_page = LoginPage(driver)
        main_page = MainPage(driver)

        assert welcome_page.is_opened()
        assert welcome_page.login()
        assert login_page.is_opened()
        assert login_page.proceed_with_email(TestBase.data()['existing_login'])
        assert login_page.proceed_with_password(
            TestBase.data()['existing_password'])
        assert login_page.login()
        assert login_page.is_login_suceed()
        assert main_page.logout()
        assert welcome_page.is_opened()
Beispiel #6
0
    def test_login_fail(self, driver):

        welcome_page = WelcomePage(driver)
        login_page = LoginPage(driver)
        main_page = MainPage(driver)

        assert welcome_page.is_opened()
        assert welcome_page.login()
        assert login_page.is_opened()
        assert login_page.proceed_with_email(
            TestBase.data()['not_existing_login'], attlasian=False)
        assert login_page.proceed_with_password(
            TestBase.data()['not_existing_password'], attlasian=False)
        assert login_page.login(attlasian=False)
        assert login_page.is_login_failed()
        assert login_page.close_dialog()
Beispiel #7
0
    def __init__(self):
        TestBase.__init__(self)

        # factors for information theory testing
        self.fX1 = Factor(self.X, [0.5, 0.5])
        self.fX2 = Factor(self.X, [0.0, 1.0])
        self.fX3 = Factor(self.X, [1.0, 0.0])

        self.fXY1 = Factor([self.X, self.Y], [0.25, 0.25, 0.25, 0.25])
        self.fXY2 = Factor([self.X, self.Y], [0.1, 0.2, 0.3, 0.4])
        self.fXY3 = Factor([self.X, self.Y], [0.4, 0.3, 0.2, 0.1])

        self.P1 = Factor([self.X], [0.5, 0.5])
        self.Q1 = Factor([self.X], [0.9, 0.1])

        self.P2 = Factor([self.X, self.Y], [0.25, 0.25, 0.25, 0.25])
        self.Q2 = Factor([self.X, self.Y], [0.8, 0.05, 0.05, 0.8])
Beispiel #8
0
    def __init__(self):
        TestBase.__init__(self)

        # factors for information theory testing
        self.fX1 = Factor(self.X, [0.5, 0.5])
        self.fX2 = Factor(self.X, [0.0, 1.0])
        self.fX3 = Factor(self.X, [1.0, 0.0])

        self.fXY1 = Factor([self.X, self.Y], [0.25, 0.25, 0.25, 0.25])
        self.fXY2 = Factor([self.X, self.Y], [0.1, 0.2, 0.3, 0.4])
        self.fXY3 = Factor([self.X, self.Y], [0.4, 0.3, 0.2, 0.1])

        self.P1 = Factor([self.X], [0.5, 0.5])
        self.Q1 = Factor([self.X], [0.9, 0.1])

        self.P2 = Factor([self.X, self.Y], [0.25, 0.25, 0.25, 0.25])
        self.Q2 = Factor([self.X, self.Y], [0.8, 0.05, 0.05, 0.8])
Beispiel #9
0
    def take_screenshot(self):
        # assert description is None or isinstance(description, str)

        # if self.driver is not None and self.driver.driver is not None:
        # description = "_"+description if description is not None else ""
        # screenshot_file_path = self.test_logs_path + "/" + str(self.counter) + description + "_screenshot.png"
        TestBase(self).take_screenshot()

        self.counter += 1
Beispiel #10
0
 def setUp(self):
     TestBase.setUp(self)
     self.dataset = Dataset.save(self.test_dataset_ids['good_eats.csv'])
     dframe = self.test_data['good_eats.csv']
     Dataset.build_schema(self.dataset, dframe.dtypes)
     Observation.save(dframe, self.dataset)
     self.calculations = [
         'rating',
         'gps',
         'amount + gps_alt',
         'amount - gps_alt',
         'amount + 5',
         'amount - gps_alt + 2.5',
         'amount * gps_alt',
         'amount / gps_alt',
         'amount * gps_alt / 2.5',
         'amount + gps_alt * gps_precision',
         '(amount + gps_alt) * gps_precision',
         'amount = 2',
         '10 < amount',
         '10 < amount + gps_alt',
         'not amount = 2',
         'not(amount = 2)',
         'amount = 2 and 10 < amount',
         'amount = 2 or 10 < amount',
         'not not amount = 2 or 10 < amount',
         'not amount = 2 or 10 < amount',
         '(not amount = 2) or 10 < amount',
         'not(amount = 2 or 10 < amount)',
         'amount ^ 3',
         '(amount + gps_alt) ^ 2 + 100',
         '-amount',
         '-amount < gps_alt - 100',
         'rating in ["delectible"]',
         'risk_factor in ["low_risk"]',
         'amount in ["9.0", "2.0", "20.0"]',
         '(risk_factor in ["low_risk"]) and (amount in ["9.0", "20.0"])',
     ]
     self.places = 5
Beispiel #11
0
 def get_filedriver_exe(browser):
     ''' 
         Returns the name of the executable driver file based on browser type.  
         Note:
         1.  Make sure driver file is set to be able to execute (i.e. chmod +x geckodriver)
         2.  Chromdedriver download - https://chromedriver.chromium.org/downloads
         3.  Filrefox driver download - https://github.com/mozilla/geckodriver/releases
     '''
     if browser == "firefox":
         if 'darwin' in platform.lower():
             return os.path.join(os.getcwd(), 'drivers', 'geckodriver')
         elif 'win32' in platform.lower():
             return os.path.join(os.getcwd(), 'drivers', 'geckodriver.exe')
         elif 'linux' in platform.lower():
             return os.path.join(os.getcwd(), 'drivers',
                                 'geckodriver_linux')
     elif browser == "chrome":
         if 'darwin' in platform.lower():
             return os.path.join(os.getcwd(), 'drivers', 'chromedriver_87')
         elif 'win32' in platform.lower():
             return os.path.join(os.getcwd(), 'drivers',
                                 'chromedriver_87.exe')
         elif 'linux' in platform.lower():
             return os.path.join(os.getcwd(), 'drivers',
                                 'chromedriver_linux')
     elif browser == "ie":
         if 'darwin' in platform.lower():
             TestBase.skip_test(
                 " - Attempting to run test(s) using IE on Mac.  Only supports IE on Windows"
             )
             return None
         elif 'win32' in platform.lower():
             return os.path.join(os.getcwd(), 'drivers',
                                 'iedriverserver.exe')
         elif 'linux' in platform.lower():
             TestBase.skip_test(
                 " - Attempting to run test(s) using IE on Linux.  Only supports IE on Windows"
             )
             return None
Beispiel #12
0
 def setUp(self):
     self.parser = Parser()
     self.row = {'VAR': 1}
     TestBase.setUp(self)
 def __init__(self, methodName):
     TestBase.__init__(self, methodName, 'test-files')
Beispiel #14
0
import unittest
from tests.test_base import TestBase
from api.models.user_model import User
from api.database.engine import DbConnection

base = TestBase()


class TestUserView(unittest.TestCase):
    def setUp(self):
        """
        Setup database connection
        """
        self.db_services = DbConnection()

    def tearDown(self):
        """
        teardown database
        """
        self.db_services.reset_database()

    def test_register_user_succesfuly(self):
        """
        Test registering a user succesfuly
        """
        response = base.register_user()
        self.assertEqual(response.status_code, 201)

    def test_register_user_with_blank_password(self):
        """
        Test registering a user without a password
Beispiel #15
0
 def setUp(self):
     TestBase.setUp(self)
     self.controller = Root()
Beispiel #16
0
 def setUp(self):
     TestBase.setUp(self)
Beispiel #17
0
    def create_web_driver(**kwargs):
        '''
            Returns a WebDriver instance based on configurationa and capabilities provided under kwargs
            kwargs -  A {} with the following parameters:
                browser:  
        '''
        if kwargs["browser"] == "chrome":

            if kwargs["localdriver"]:
                chromedriver_path = DriverFactory.get_filedriver_exe("chrome")

                if os.path.exists(chromedriver_path):
                    os.environ["webdriver.chrome.driver"] = chromedriver_path
                else:
                    raise Exception(" [E] - Chromedriver file is not found: " +
                                    chromedriver_path)

                return webdriver.Chrome(chromedriver_path)

            # Wait for Seleinum docker container URL and Port connection to be open
            if not DriverFactory.isOpen(kwargs["host"], int(kwargs["port"])):
                TestBase.skip_test(
                    " Running in DOCKER:CHROME mode -  Attempting to reach Selenium standalone continaer at http://{0}:{1}/ FAILED.\n  Provide an open --host and/or --port values and try again."
                    .format(kwargs["host"], kwargs["port"]))
                return None

            return webdriver.Remote(
                "http://" + kwargs["host"] + ":" + kwargs["port"] + "/wd/hub",
                DesiredCapabilities.CHROME)

        elif kwargs["browser"] == "firefox":
            if kwargs["localdriver"]:
                firefoxdriver_path = DriverFactory.get_filedriver_exe(
                    "firefox")

                if os.path.exists(firefoxdriver_path):
                    os.environ["webdriver.gecko.driver"] = firefoxdriver_path
                else:
                    raise Exception(
                        " [E] - Firefoxdriver file is not found: " +
                        firefoxdriver_path)

                return webdriver.Firefox(executable_path=firefoxdriver_path)

            # Wait for Seleinum docker container URL and Port connection to be open
            if not DriverFactory.isOpen(kwargs["host"], int(kwargs["port"])):
                TestBase.skip_test(
                    " Running in DOCKER:FIREFOX mode -  Attempting to reach Selenium standalone continaer at http://{0}:{1}/ FAILED.\n  Provide an open --host and/or --port values and try again."
                    .format(kwargs["host"], kwargs["port"]))
                return None

            return webdriver.Remote(
                "http://" + kwargs["host"] + ":" + kwargs["port"] + "/wd/hub",
                DesiredCapabilities.FIREFOX)

        elif kwargs["browser"] == "ie":
            if not kwargs["localdriver"]:
                TestBase.skip_test(
                    " Running in DOCKER:IE mode is not supported.  IE is only supported running Local webdriver (--localdriver)"
                )
                return None

            iedriver_path_file = DriverFactory.get_filedriver_exe("ie")

            if os.path.exists(iedriver_path_file):
                os.environ["webdriver.ie.driver"] = iedriver_path_file
            else:
                raise Exception(" [E] - IE Driver Server file is not found: " +
                                iedriver_path_file)

            return webdriver.Ie(executable_path=iedriver_path_file)

        elif kwargs["browser"] == "safari":
            if not kwargs["localdriver"]:
                TestBase.skip_test(
                    " Running in DOCKER:SAFARI mode is not supported.  SAFARI is only supported running Local webdriver (--localdriver)"
                )
                return None

            if not 'darwin' in platform.lower():
                TestBase.skip_test(
                    " - Attempting to run test on Safari running on Windows or Linux?  Only supports Safari on Mac"
                )

            return webdriver.Safari()

        else:
            TestBase.skip_test(
                " -  Browser type {0} not recognize.  Provide from supported browsers (--browser) Chrome, Safari, Firefox and IE"
                .format(kwargs["browser"]))
            return None
 def __init__(self, methodName):
     TestBase.__init__(self, methodName, testroot)
Beispiel #19
0
 def setUp(self):
     TestBase.setUp(self)
     self.controller = Version()
 def __init__(self, methodName):
     TestBase.__init__(self, methodName, 'test-files')
     self.UpdateResourcesFunction = StatsProcessor.updateResources
Beispiel #21
0
 def __init__(self, methodName):
     TestBase.__init__(self, methodName, 'test-files')
     self.CleanUpFunction = UpdateScriptHandler.cleanUp
     self.UpdateResourcesFunction = StatsProcessor.updateResources
 def __init__(self, methodName):
     TestBase.__init__(self, methodName, TESTROOT)
Beispiel #23
0
 def setUp(self):
     TestBase.setUp(self)
     self.dataset = Dataset.save(self.test_dataset_ids['good_eats.csv'])
     Dataset.build_schema(self.dataset,
             self.test_data['good_eats.csv'].dtypes)