Ejemplo 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
Ejemplo 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
Ejemplo 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
Ejemplo 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
Ejemplo 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"
Ejemplo 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
Ejemplo 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
Ejemplo 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
Ejemplo 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
Ejemplo 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"
Ejemplo 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
Ejemplo 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
Ejemplo 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
Ejemplo 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
Ejemplo 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