Ejemplo n.º 1
0
    def test_run_invalid_option(self, capsys):
        instance = emailparse.EmailParse()
        instance.set_commandline(["invalid"])

        instance.run()
        out, err = capsys.readouterr()
        assert re.search(r".*unrecognized arguments:.*", out)
Ejemplo n.º 2
0
    def test_run_short_help(self, capsys):
        instance = emailparse.EmailParse()
        instance.set_commandline(["-h"])

        instance.run()
        out, err = capsys.readouterr()
        assert re.search(r"^usage:.*", out)
Ejemplo n.º 3
0
    def test_all(self, capsys, filename, expected):
        __sessions__.new(os.path.join(FIXTURE_DIR, filename))
        instance = emailparse.EmailParse()
        instance.command_line = ['-a']

        instance.run()
        out, err = capsys.readouterr()

        for e in expected:
            assert re.search(e, out)
Ejemplo n.º 4
0
 def test_args_exception(self):
     instance = emailparse.EmailParse()
     with pytest.raises(ArgumentErrorCallback) as excinfo:
         instance.parser.parse_args(["-h"])
     excinfo.match(r".*Parse eml and msg email files.*")
Ejemplo n.º 5
0
 def test_init(self):
     instance = emailparse.EmailParse()
     assert isinstance(instance, emailparse.EmailParse)
     assert isinstance(instance, Module)