Esempio n. 1
0
 def test_get_options_too_many_args(self):
     try:
         get_options(argv=['fakeoooctl', 'too', 'much'])
     except(SystemExit) as err:
         self.assertEqual(err.code, 2)
     else:
         self.fail('SystemExit exception expected.')
     return
Esempio n. 2
0
 def test_get_options_invalid_command(self):
     try:
         get_options(argv=['fakeoooctl', 'maybestart'])
     except(SystemExit) as err:
         self.assertEqual(err.code, 2)
     else:
         self.fail('SystemExit exception expected.')
     return
Esempio n. 3
0
 def test_get_options_no_argv(self):
     try:
         get_options(argv=[])
     except(SystemExit) as err:
         self.assertEqual(err.code, 2)
     else:
         self.fail('SystemExit exception expected.')
     return
Esempio n. 4
0
 def test_get_options_invalid_binpath(self):
     # we should not pass an invalid path to executable
     try:
         get_options(argv=['fakeoooctl', '-b', 'invalid-path', 'start'])
     except(SystemExit) as err:
         self.assertEqual(err.code, 2)
     else:
         self.fail('SystemExit exception expected.')
     return
Esempio n. 5
0
 def test_get_options(self):
     cmd, options = get_options(["fakeoooctl", "start"])
     assert cmd == "start"
     assert options.binarypath is not None
     assert options.pidfile == "/tmp/ooodaemon.pid"
Esempio n. 6
0
 def test_get_options_invalid_binpath(self):
     # we should not pass an invalid path to executable
     with pytest.raises(SystemExit) as why:
         get_options(argv=['fakeoooctl', '-b', 'invalid-path', 'start'])
     code = getattr(why.value, "code", why.value)
     assert code == 2
Esempio n. 7
0
 def test_get_options_too_many_args(self):
     with pytest.raises(SystemExit) as why:
         get_options(argv=['fakeoooctl', 'too', 'much'])
     code = getattr(why.value, "code", why.value)
     assert code == 2
Esempio n. 8
0
 def test_get_options_invalid_command(self):
     with pytest.raises(SystemExit) as why:
         get_options(argv=['fakeoooctl', 'maybestart'])
     code = getattr(why.value, "code", why.value)
     assert code == 2
Esempio n. 9
0
 def test_get_options_no_argv(self):
     with pytest.raises(SystemExit) as why:
         get_options(argv=[])
     code = getattr(why.value, "code", why.value)
     assert code == 2
Esempio n. 10
0
 def test_get_options(self):
     cmd, options = get_options(["fakeoooctl", "start"])
     assert cmd == "start"
     assert options.binarypath is not None
     assert options.pidfile == "/tmp/ooodaemon.pid"
Esempio n. 11
0
 def test_get_options_invalid_binpath(self):
     # we should not pass an invalid path to executable
     with pytest.raises(SystemExit) as why:
         get_options(argv=['fakeoooctl', '-b', 'invalid-path', 'start'])
     code = getattr(why.value, "code", why.value)
     assert code == 2
Esempio n. 12
0
 def test_get_options_too_many_args(self):
     with pytest.raises(SystemExit) as why:
         get_options(argv=['fakeoooctl', 'too', 'much'])
     code = getattr(why.value, "code", why.value)
     assert code == 2
Esempio n. 13
0
 def test_get_options_invalid_command(self):
     with pytest.raises(SystemExit) as why:
         get_options(argv=['fakeoooctl', 'maybestart'])
     code = getattr(why.value, "code", why.value)
     assert code == 2
Esempio n. 14
0
 def test_get_options_no_argv(self):
     with pytest.raises(SystemExit) as why:
         get_options(argv=[])
     code = getattr(why.value, "code", why.value)
     assert code == 2
Esempio n. 15
0
 def test_get_options(self):
     cmd, options = get_options(['fakeoooctl', 'start'])
     self.assertEqual(cmd, 'start')
     self.assertTrue(options.binarypath is not None)
     self.assertEqual(options.pidfile, '/tmp/ooodaemon.pid')
     return