X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=test%2Fconfig%2Fcreate_user_pyconf.py;h=6036d301502d77a73e2796ecf5a4b9aca350e9da;hb=e4906af5db78d7b0f7ff402b673d5702e2dee445;hp=4b5a256feed8e95714ff30474db9afc644ed0ae2;hpb=c3f03fb1a8d8a5a20baef855572c2e999433ff13;p=tools%2Fsat.git diff --git a/test/config/create_user_pyconf.py b/test/config/create_user_pyconf.py index 4b5a256..6036d30 100644 --- a/test/config/create_user_pyconf.py +++ b/test/config/create_user_pyconf.py @@ -23,30 +23,32 @@ import shutil # get execution path testdir = os.path.dirname(os.path.realpath(__file__)) -sys.path.append(os.path.join(testdir, '..', '..', 'src')) -sys.path.append(os.path.join(testdir, '..', '..', 'test', '_testTools')) +sys.path.append(os.path.join(testdir, '..', '..')) +sys.path.append(os.path.join(testdir, '..', '_testTools')) -from salomeTools import salomeTools +from salomeTools import Sat import HTMLTestRunner class TestConfig(unittest.TestCase): '''pyunit class : each method execute one test. ''' - def test_option_value(self): - '''Test the display of the right value of "sat config -v VARS.hostname" + def test_user_dir_creation(self): + '''Creation of ~/.salomeTools/salomeTools.pyconf ''' res = "KO" user_dir = os.path.expanduser(os.path.join('~','.salomeTools')) user_dir_save = os.path.expanduser(os.path.join('~','.salomeTools_save')) + if os.path.exists(user_dir_save): + shutil.rmtree(user_dir_save) if os.path.exists(user_dir): shutil.move(user_dir, user_dir_save) # The command to test - sat = salomeTools('') + sat = Sat('') sat.config('-v .') - expected_file = os.path.expanduser(os.path.join('~','.salomeTools', 'salomeTools-' + sat.cfg.INTERNAL.sat_version + ".pyconf")) + expected_file = os.path.expanduser(os.path.join('~','.salomeTools', 'salomeTools.pyconf')) if os.path.exists(expected_file): res = "OK" @@ -57,6 +59,83 @@ class TestConfig(unittest.TestCase): # pyunit method to compare 2 str self.assertEqual(res, "OK") + def test_override_VARS(self): + '''override VARS + ''' + OK = "KO" + + # The command to test + sat = Sat("-oVARS.user='user_test'") + sat.config() + + if sat.cfg.VARS.user == 'user_test': + OK = "OK" + + # pyunit method to compare 2 str + self.assertEqual(OK, "OK") + + def test_override_INTERNAL(self): + '''override INTERNAL + ''' + OK = "KO" + + # The command to test + sat = Sat("-oINTERNAL.sat_version='V0'") + sat.config() + + if sat.cfg.INTERNAL.sat_version == 'V0': + OK = "OK" + + # pyunit method to compare 2 str + self.assertEqual(OK, "OK") + + """ + def test_override_SITE(self): + '''override SITE + ''' + OK = "KO" + + # The command to test + sat = Sat("-oSITE.jobs.config_path='/tmp'") + sat.config() + + if sat.cfg.SITE.jobs.config_path == '/tmp': + OK = "OK" + + # pyunit method to compare 2 str + self.assertEqual(OK, "OK") + """ + + def test_override_APPLICATION(self): + '''override APPLICATION + ''' + OK = "KO" + + # The command to test + sat = Sat("-oAPPLICATION.out_dir='/tmp'") + sat.config('appli-test') + + if sat.cfg.APPLICATION.out_dir == '/tmp': + OK = "OK" + + # pyunit method to compare 2 str + self.assertEqual(OK, "OK") + + def test_override_PRODUCTS(self): + '''override PRODUCTS + ''' + OK = "KO" + + # The command to test + sat = Sat("-oPRODUCTS.PRODUCT_GIT.default.name='test'") + sat.config('') + + if sat.cfg.PRODUCTS.PRODUCT_GIT.default.name == 'test': + OK = "OK" + + # pyunit method to compare 2 str + self.assertEqual(OK, "OK") + # test launch if __name__ == '__main__': HTMLTestRunner.main()