Package test_suite :: Package gui_tests :: Module dead_uf_pages
[hide private]
[frames] | no frames]

Source Code for Module test_suite.gui_tests.dead_uf_pages

 1  ############################################################################### 
 2  #                                                                             # 
 3  # Copyright (C) 2012 Edward d'Auvergne                                        # 
 4  #                                                                             # 
 5  # This file is part of the program relax.                                     # 
 6  #                                                                             # 
 7  # relax is free software; you can redistribute it and/or modify               # 
 8  # it under the terms of the GNU General Public License as published by        # 
 9  # the Free Software Foundation; either version 2 of the License, or           # 
10  # (at your option) any later version.                                         # 
11  #                                                                             # 
12  # relax is distributed in the hope that it will be useful,                    # 
13  # but WITHOUT ANY WARRANTY; without even the implied warranty of              # 
14  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               # 
15  # GNU General Public License for more details.                                # 
16  #                                                                             # 
17  # You should have received a copy of the GNU General Public License           # 
18  # along with relax; if not, write to the Free Software                        # 
19  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA   # 
20  #                                                                             # 
21  ############################################################################### 
22   
23  # Module docstring. 
24  """GUI tests for catching dead user function pages.""" 
25   
26  # Python module imports. 
27  import sys 
28   
29  # relax module imports. 
30  from relax_errors import RelaxNoPipeError 
31  from test_suite.gui_tests.base_classes import GuiTestCase 
32   
33  # relax GUI imports. 
34  from gui.interpreter import Interpreter; interpreter = Interpreter() 
35  from gui.uf_objects import Uf_storage; uf_store = Uf_storage() 
36   
37   
38 -class Dead_uf_pages(GuiTestCase):
39 """Class for testing the failure of user function pages.""" 40
41 - def test_mol_create(self):
42 """Test a failure detected via the molecule.create user function.""" 43 44 # The user function objects. 45 mol_create = uf_store['molecule.create'] 46 pipe_create = uf_store['pipe.create'] 47 48 # First try to create a molecule (this will fail due to no data pipes being present). 49 try: 50 # Call the object, then simulate the 'ok' click. 51 mol_create(mol_name='x', mol_type='protein') 52 mol_create.wizard._ok() 53 interpreter.flush() 54 except RelaxNoPipeError, instance: 55 sys.stderr.write(instance.__str__()) 56 57 # Create a data pipe. 58 pipe_create(pipe_name='test', pipe_type='mf') 59 pipe_create.wizard._ok() 60 interpreter.flush() 61 62 # Try to create the molecule a second time. 63 mol_create(mol_name='x', mol_type='protein') 64 mol_create.wizard._ok() 65 interpreter.flush() 66 67 # Checks. 68 self.assertEqual(len(cdp.mol), 1) 69 self.assertEqual(cdp.mol[0].name, 'x')
70