コード例 #1
0
ファイル: test_AnyMate.py プロジェクト: bitmuster/AnyMate
 def test_main_nofile(self, mock):
     #setup
     myfile = 'nofile'
     mock.return_value = False
     #exercise
     with self.assertRaises(SystemExit):
         main(['./AnyMate.py', myfile])
コード例 #2
0
ファイル: test_AnyMate.py プロジェクト: bitmuster/AnyMate
 def test_main_mockedfile(self, anymock, guimock, filemock):
     #setup
     myfile = 'nofile'
     filemock.return_value = True
     #exercise
     main(['./AnyMate.py', myfile])
     #validate
     anymock.assert_called_once_with(myfile)
コード例 #3
0
ファイル: test_AnyMate.py プロジェクト: bitmuster/AnyMate
 def test_main_four_wrong_file(self, mock):
     #setup
     myfile = 'nofile'
     conf = 'hello'
     anym = MagicMock()
     mock.return_value = anym
     #exercise
     with self.assertRaises(SystemExit):
         main(['./AnyMate.py', '--nogui', conf, myfile])
コード例 #4
0
ファイル: test_AnyMate.py プロジェクト: bitmuster/AnyMate
 def test_main_four_wrong_param(self, mock):
     #setup
     myfile = 'template.anymate'
     conf = 'hello'
     anym = MagicMock()
     mock.return_value = anym
     #exercise
     with self.assertRaises(SystemExit):
         main(['./AnyMate.py', 'BAM', conf, myfile])
コード例 #5
0
ファイル: test_AnyMate.py プロジェクト: bitmuster/AnyMate
 def test_main_two_real_param(self, mock, guimock):
     #setup
     myfile = 'template.anymate'
     mock.return_value = "Something"
     #exercise
     main(['./AnyMate.py', myfile])
     #validate
     mock.assert_called_once_with(myfile)
     # We expect the gui to be called with the return value of AnyMate()
     guimock.assert_called_once_with("Something", myfile)
コード例 #6
0
ファイル: test_AnyMate.py プロジェクト: bitmuster/AnyMate
 def test_main_four_real_param(self, mock):
     #setup
     myfile = 'template.anymate'
     conf = 'hello'
     anym = MagicMock()
     mock.return_value = anym
     #exercise
     main(['./AnyMate.py', '--nogui', conf, myfile])
     #validate
     mock.assert_called_once_with(myfile)
     anym.execute.assert_called_once_with(conf)
コード例 #7
0
ファイル: test_AnyMate.py プロジェクト: bitmuster/AnyMate
 def test_main_mainloop(self, anymock, guimock, filemock):
     #setup
     myfile = 'nofile'
     filemock.return_value = True
     #Anymate() returns an AnymateObject
     anymock.return_value = MagicMock(name='AnyMate')
     gui = MagicMock(name='AnyMateGui')
     guimock.return_value = gui
     #exercise
     main(['./AnyMate.py', myfile])
     #validate
     anymock.assert_called_once_with(myfile)
     gui.rootwin.mainloop.assert_called_once_with()
コード例 #8
0
ファイル: test_AnyMate.py プロジェクト: bitmuster/AnyMate
 def test_main_three_param(self):
     with self.assertRaises(SystemExit):
         main(["one", "two", "three"])
コード例 #9
0
ファイル: test_AnyMate.py プロジェクト: bitmuster/AnyMate
 def test_main_fife_param(self):
     with self.assertRaises(SystemExit):
         main(["bad"] * 5)
コード例 #10
0
ファイル: test_AnyMate.py プロジェクト: bitmuster/AnyMate
 def test_main_one_param(self):
     with self.assertRaises(SystemExit):
         main(["one"])
コード例 #11
0
ファイル: test_AnyMate.py プロジェクト: bitmuster/AnyMate
 def test_main_listparam(self):
     with self.assertRaises(SystemExit):
         main([])
コード例 #12
0
ファイル: test_AnyMate.py プロジェクト: bitmuster/AnyMate
 def test_main_intparam(self, mock):
     with self.assertRaises(SystemExit):
         main(88)
     mock.assert_called_once_with()
コード例 #13
0
ファイル: test_AnyMate.py プロジェクト: bitmuster/AnyMate
 def test_main_help(self, mock):
     with self.assertRaises(SystemExit):
         main('')
     mock.assert_called_once_with()
コード例 #14
0
ファイル: test_AnyMate.py プロジェクト: bitmuster/AnyMate
 def test_main_noparam(self):
     with self.assertRaises(TypeError):
         main()