Salome HOME
Merge branch 'BR_8_3' of https://codev-tuleap.cea.fr/plugins/git/spns/SAT into BR_8_3
[tools/sat.git] / test / config / option_value_2.py
index ddf05282927f4b8f6669139891445da82162e90b..ba5a9c677cac07eddf6685fc2047c416719799e8 100644 (file)
 import unittest
 import os
 import sys
+import platform
 
 # 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
 from tools import outRedirection
 import HTMLTestRunner
 
 class TestConfig(unittest.TestCase):
-    '''pyunit class : each method execute one test.
+    '''test of sat config -v VARS.python
     '''
     
     def test_option_value(self):
-        '''Test the display of the right value of "sat config -v VARS.hostname"
+        '''Test the display of the right value of "sat config -v VARS.python"
         '''
-        # expected value
-        expected = '\x1b[36mhostname\x1b[0m: is221560\n'
+        
+        OK = 'KO'
 
         # output redirection
         my_out = outRedirection()
 
         # The command to test
-        sat = salomeTools('')
+        sat = Sat('')
         sat.config('-v VARS.python')
 
         # stop output redirection
@@ -51,31 +52,68 @@ class TestConfig(unittest.TestCase):
 
         # get results
         res = my_out.read_results()
+        
+        
+        if platform.python_version() in res:
+            OK = 'OK'
 
         # pyunit method to compare 2 str
-        self.assertEqual(res, expected)
+        self.assertEqual(OK, 'OK')
 
-    def test_option_list(self):
-        '''Test the display of the right value of "sat config -l"
+    def test_option_schema(self):
+        '''Test the display of the right value of "sat config -s"
         '''
-        # expected value
-        expected = '------ \x1b[34m/home/salome/SPN_PRIVATE/sat5dev_Applications\x1b[0m\nappli-test\n\n------ \x1b[34m/export/home/serioja/.salomeTools/Applications\x1b[0m\n\n'
+        
+        OK = 'KO'
 
         # output redirection
         my_out = outRedirection()
 
         # The command to test
-        sat = salomeTools('')
-        sat.config('-l')
+        sat = Sat('')
+        sat.config('-s')
 
         # stop output redirection
         my_out.end_redirection()
 
         # get results
         res = my_out.read_results()
+        
+        
+        if 'INTERNAL' in res:
+            OK = 'OK'
 
         # pyunit method to compare 2 str
-        self.assertEqual(res, expected)
+        self.assertEqual(OK, 'OK')
+        
+    def test_option_info(self):
+        '''Test the display of the right value of "sat config -i"
+        '''
+        
+        application = 'appli-test'
+        product = 'PRODUCT_DEV'
+        
+        OK = 'KO'
+
+        # output redirection
+        my_out = outRedirection()
+
+        # The command to test
+        sat = Sat('')
+        sat.config(application + ' --info ' + product)
+
+        # stop output redirection
+        my_out.end_redirection()
+
+        # get results
+        res = my_out.read_results()
+        
+        
+        if 'compilation method = cmake' in res:
+            OK = 'OK'
+
+        # pyunit method to compare 2 str
+        self.assertEqual(OK, 'OK')
 
 # test launch
 if __name__ == '__main__':