コード例 #1
0
 def test_initialize_startup(self):
     """
     Test "reset_database" and "initialize_startup" calls.
     """
     reset_database()
     # Table USERS should not exist:
     self.assertRaises(Exception, dao.get_all_users)
     
     initialize_startup()
     # Table exists, but no rows
     self.assertEqual(0, len(dao.get_all_users()))
     self.assertEqual(None, dao.get_system_user())
     # DB revisions folder should exist:
     self.assertTrue(os.path.exists(TvbProfile.current.db.DB_VERSIONING_REPO))
コード例 #2
0
 def test_initialize_startup(self):
     """
     Test "reset_database" and "initialize_startup" calls.
     """
     reset_database()
     # Table USERS should not exist:
     self.assertRaises(Exception, dao.get_all_users)
     
     initialize_startup()
     # Table exists, but no rows
     self.assertEqual(0, len(dao.get_all_users()))
     self.assertEqual(None, dao.get_system_user())
     # DB revisions folder should exist:
     self.assertTrue(os.path.exists(TvbProfile.current.db.DB_VERSIONING_REPO))
コード例 #3
0
    def test_initialize_startup(self):
        """
        Test "reset_database" and "initialize_startup" calls.
        """
        reset_database()
        # Table USERS should not exist:
        with pytest.raises(Exception):
            dao.get_all_users()

        initialize_startup()
        # Table exists, but no rows
        assert 0 == len(dao.get_all_users())
        assert None == dao.get_system_user()
        # DB revisions folder should exist:
        assert os.path.exists(TvbProfile.current.db.DB_VERSIONING_REPO)
コード例 #4
0
def init_test_env():
    """
    This method prepares all necessary data for tests execution
    """
    # Set a default test profile, for when running tests from dev-env.
    if TvbProfile.CURRENT_PROFILE_NAME is None:
        TvbProfile.set_profile(TvbProfile.TEST_SQLITE_PROFILE)
        print "Not expected to happen except from PyCharm: setting profile", TvbProfile.CURRENT_PROFILE_NAME
        db_file = TvbProfile.current.db.DB_URL.replace("sqlite:///", "")
        if os.path.exists(db_file):
            os.remove(db_file)

    from tvb.core.entities.model_manager import reset_database
    from tvb.core.services.initializer import initialize

    reset_database()
    initialize(["tvb.config", "tvb.tests.framework"], skip_import=True)
コード例 #5
0
def init_test_env():
    """
    This method prepares all necessary data for tests execution
    """
    # Set a default test profile, for when running tests from dev-env.
    if TvbProfile.CURRENT_PROFILE_NAME is None:
        TvbProfile.set_profile(TvbProfile.TEST_SQLITE_PROFILE)
        print "Not expected to happen except from PyCharm: setting profile", TvbProfile.CURRENT_PROFILE_NAME
        db_file = TvbProfile.current.db.DB_URL.replace('sqlite:///', '')
        if os.path.exists(db_file):
            os.remove(db_file)

    from tvb.core.entities.model_manager import reset_database
    from tvb.core.services.initializer import initialize

    reset_database()
    initialize(["tvb.config", "tvb.tests.framework"], skip_import=True)
コード例 #6
0
ファイル: base_testcase.py プロジェクト: maedoc/tvb-framework
def init_test_env():
    """
    This method prepares all necessary data for tests execution
    """
    # Set a default test profile, for when running tests from dev-env.
    if TvbProfile.CURRENT_PROFILE_NAME is None:
        profile = TvbProfile.TEST_SQLITE_PROFILE
        if len(sys.argv) > 1:
            for i in range(1,len(sys.argv)-1):
                if "--profile=" in sys.argv[i]:
                    profile = sys.argv[i].split("=")[1]
        TvbProfile.set_profile(profile)
        print("Not expected to happen except from PyCharm: setting profile", TvbProfile.CURRENT_PROFILE_NAME)
        db_file = TvbProfile.current.db.DB_URL.replace('sqlite:///', '')
        if os.path.exists(db_file):
            os.remove(db_file)

    from tvb.core.entities.model_manager import reset_database
    from tvb.core.services.initializer import initialize

    reset_database()
    initialize(["tvb.config", "tvb.tests.framework"], skip_import=True)
コード例 #7
0
def reset():
    """
    Service Layer for Database reset.
    """
    reset_database()
コード例 #8
0
def reset():
    """
    Service Layer for Database reset.
    """
    reset_database()