Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ENH+TST: mail url collector: save file name
- Loading branch information
Sebastian Wagner
committed
Sep 10, 2019
1 parent
f4a3328
commit cadc193
Showing
9 changed files
with
99 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1 @@ | |||
bar text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,18 @@ | |||
To: cert@example.com | |||
From: Sebastian Wagner <wagner@cert.at> | |||
Subject: foobar txt | |||
Message-ID: <07ce0153-060b-f48d-73d9-d92a20b3b3aa@cert.at> | |||
Date: Tue, 3 Sep 2019 16:57:40 +0200 | |||
MIME-Version: 1.0 | |||
Content-Type: multipart/mixed; | |||
boundary="------------1D845FBEEAAC1F68B4B45905" | |||
Content-Language: en-US | |||
|
|||
This is a multi-part message in MIME format. | |||
--------------1D845FBEEAAC1F68B4B45905 | |||
Content-Type: text/plain; charset=utf-8 | |||
Content-Transfer-Encoding: 8bit | |||
Please look at http://localhost/foobar.txt | |||
--------------1D845FBEEAAC1F68B4B45905-- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,40 @@ | |||
#!/usr/bin/env python3 | |||
# -*- coding: utf-8 -*- | |||
""" | |||
Created on Tue Sep 10 17:10:54 2019 | |||
@author: sebastian | |||
""" | |||
import os | |||
|
|||
|
|||
from imbox.parser import parse_email | |||
with open(os.path.join(os.path.dirname(__file__), 'foobarzip.eml')) as handle: | |||
EMAIL_ZIP_FOOBAR = parse_email(handle.read()) | |||
with open(os.path.join(os.path.dirname(__file__), 'foobartxt.eml')) as handle: | |||
EMAIL_TXT_FOOBAR = parse_email(handle.read()) | |||
|
|||
|
|||
class MockedImbox(): | |||
def __init__(self, hostname, username=None, password=None, ssl=True, | |||
port=None, ssl_context=None, policy=None, starttls=False): | |||
pass | |||
|
|||
def messages(self, *args, **kwargs): | |||
raise NotImplementedError | |||
|
|||
def mark_seen(self, uid): | |||
pass | |||
|
|||
def logout(self): | |||
pass | |||
|
|||
|
|||
class MockedZipImbox(MockedImbox): | |||
def messages(self, *args, **kwargs): | |||
yield 0, EMAIL_ZIP_FOOBAR | |||
|
|||
|
|||
class MockedTxtImbox(MockedImbox): | |||
def messages(self, *args, **kwargs): | |||
yield 0, EMAIL_TXT_FOOBAR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters