Example #1
0
 def test_can_update_download_is_older(self):
     # given
     with patch.dict('whyteboard.misc.meta.__dict__', {'version': "0.5"}):
         # when
         can_update = self.updater.can_update()
             
         # then
         self.assertFalse(can_update)       
Example #2
0
 def test_restart_args_source(self, is_exe):
     # given
     is_exe.return_value = False
     argv = ['whyteboard.py']
     
     with patch.dict('sys.__dict__', {'argv': argv}):
         # when
         arguments = self.updater.restart_args()
         
         # then
         self.assertEqual(['python', ['python', argv[0]]], arguments)
Example #3
0
 def test_restart_args_source_with_filename(self, is_exe):
     # given
     is_exe.return_value = False
     argv = ['whyteboard.py']
     _file = "c:\test\whyteboard test.wtbd"
     
     with patch.dict('sys.__dict__', {'argv': argv}):
         # when
         arguments = self.updater.restart_args(_file)
         
         # then
         self.assertEqual(['python', ['python', argv[0], "--file", '"%s"' % _file]], arguments)  
Example #4
0
 def test_restart_args_windows_exe(self, is_exe):
     # given
     is_exe.return_value = True
     argv = ['whyteboard.exe']
     current_dir = os.path.dirname(os.path.abspath(sys.argv[1]))
     
     with patch.dict('sys.__dict__', {'argv': argv}):
         # when
         arguments = self.updater.restart_args()
         
         # then
         expected = os.path.join(current_dir, argv[0])
         self.assertEqual([expected, [expected]], arguments)        
Example #5
0
 def test_restart_args_windows_exe_with_file(self, is_exe):
     # given
     is_exe.return_value = True
     _file = u"c:\test\whyteboard file.wtbd"
     argv = ['whyteboard.exe']
     current_dir = os.path.dirname(os.path.abspath(sys.argv[1]))
     
     with patch.dict('sys.__dict__', {'argv': argv}):
         # when
         arguments = self.updater.restart_args(_file)
         
         # then
         expected = os.path.join(current_dir, argv[0])
         self.assertEqual([expected, [expected, u"--file", '"%s"' % _file]], arguments)