コード例 #1
0
ファイル: test_main.py プロジェクト: RHInception/relent
 def test_with_no_playbooks(self):
     """
     Good playbooks should react as expectd.
     """
     with mock.patch('argparse.ArgumentParser') as ap:
         ap().parse_args.return_value = Namespace(
             playbooks=[], verbose=False, header=False)
         try:
             main()
         except SystemExit, se:
             assert se.code == 0
コード例 #2
0
 def test_with_no_playbooks(self):
     """
     Good playbooks should react as expectd.
     """
     with mock.patch('argparse.ArgumentParser') as ap:
         ap().parse_args.return_value = Namespace(playbooks=[],
                                                  verbose=False,
                                                  header=False)
         try:
             main()
         except SystemExit, se:
             assert se.code == 0
コード例 #3
0
ファイル: test_main.py プロジェクト: RHInception/relent
 def test_verbose_with_bad_plabook(self):
     """
     Bad playbooks should return too much error information.
     """
     with mock.patch('argparse.ArgumentParser') as ap:
         ap().parse_args.return_value = Namespace(
             playbooks=['tests/playbook_schema_invalid.json'],
             verbose=True, header=False)
         try:
             main()
         except SystemExit, se:
             assert se.code == 1
         assert ap()._print_message.call_count == 3
コード例 #4
0
ファイル: test_main.py プロジェクト: RHInception/relent
 def test_verbose_with_good_plabook(self):
     """
     Good playbooks should return good header.
     """
     with mock.patch('argparse.ArgumentParser') as ap:
         ap().parse_args.return_value = Namespace(
             playbooks=['tests/playbook_schema_valid.json'],
             verbose=True, header=False)
         try:
             main()
         except SystemExit, se:
             assert se.code == 0
         ap()._print_message.called_once()
コード例 #5
0
 def test_verbose_with_bad_plabook(self):
     """
     Bad playbooks should return too much error information.
     """
     with mock.patch('argparse.ArgumentParser') as ap:
         ap().parse_args.return_value = Namespace(
             playbooks=['tests/playbook_schema_invalid.json'],
             verbose=True,
             header=False)
         try:
             main()
         except SystemExit, se:
             assert se.code == 1
         assert ap()._print_message.call_count == 3
コード例 #6
0
 def test_verbose_with_good_plabook(self):
     """
     Good playbooks should return good header.
     """
     with mock.patch('argparse.ArgumentParser') as ap:
         ap().parse_args.return_value = Namespace(
             playbooks=['tests/playbook_schema_valid.json'],
             verbose=True,
             header=False)
         try:
             main()
         except SystemExit, se:
             assert se.code == 0
         ap()._print_message.called_once()