Ejemplo n.º 1
0
    def test_notify_participants(self):
        """Tests the dry-run capability of notify_participants."""
        # Save stdout and replace it with something that will capture the print
        # statement. Note: this code was taken from here:
        # http://stackoverflow.com/questions/4219717/how-to-assert-output-
        #     with-nosetest-unittest-in-python/4220278#4220278
        saved_stdout = sys.stdout

        try:
            out = StringIO()
            sys.stdout = out
            notify_participants(self.recipients, self.email_settings)
            obs_output = out.getvalue().strip()
            self.assertEqual(obs_output, exp_dry_run_output)
        finally:
            sys.stdout = saved_stdout
Ejemplo n.º 2
0
def main():
    option_parser, opts, args = parse_command_line_parameters(**script_info)

    notify_participants(open(opts.recipients, 'U'),
                        open(opts.email_settings, 'U'),
                        dry_run=not opts.really)