Esempio n. 1
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
Esempio n. 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
Esempio n. 3
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
Esempio n. 4
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()
Esempio n. 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
Esempio n. 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()