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_copy.py
1 #!/usr/bin/env python
2 #-*- coding:utf-8 -*-
3 #  Copyright (C) 2010-2012  CEA/DEN
4 #
5 #  This library is free software; you can redistribute it and/or
6 #  modify it under the terms of the GNU Lesser General Public
7 #  License as published by the Free Software Foundation; either
8 #  version 2.1 of the License.
9 #
10 #  This library is distributed in the hope that it will be useful,
11 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
12 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 #  Lesser General Public License for more details.
14 #
15 #  You should have received a copy of the GNU Lesser General Public
16 #  License along with this library; if not, write to the Free Software
17 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
18
19 import unittest
20 import os
21 import sys
22
23 # get execution path
24 testdir = os.path.dirname(os.path.realpath(__file__))
25 sys.path.append(os.path.join(testdir, '..', '..'))
26 sys.path.append(os.path.join(testdir, '..', '_testTools'))
27
28 from salomeTools import Sat
29 import HTMLTestRunner
30
31 class TestConfig(unittest.TestCase):
32     '''sat config -c
33     '''
34     
35     def test_option_copy(self):
36         '''Test the copy of a pyconf
37         '''
38         res = "KO"
39         appli_to_copy = "appli-test"
40
41         expected_file = os.path.expanduser(os.path.join('~','.salomeTools', 'Applications', 'LOCAL_' + appli_to_copy + '.pyconf'))
42         if os.path.exists(expected_file):
43             os.remove(expected_file)
44                
45         # The command to test
46         sat = Sat('')
47         sat.config('appli-test -c')
48
49
50         if os.path.exists(expected_file):
51             res = "OK"
52             os.remove(expected_file)
53
54         # pyunit method to compare 2 str
55         self.assertEqual(res, "OK")
56
57 # test launch
58 if __name__ == '__main__':
59     HTMLTestRunner.main()