initial commit
							parent
							
								
									8925dbcb47
								
							
						
					
					
						commit
						b8f4db9078
					
				@ -0,0 +1,39 @@
 | 
				
			|||||||
 | 
					import email
 | 
				
			||||||
 | 
					import smtplib
 | 
				
			||||||
 | 
					import typing
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class Connection:
 | 
				
			||||||
 | 
					    """Handles connection to host"""
 | 
				
			||||||
 | 
					    pass
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class Attachment:
 | 
				
			||||||
 | 
					    """Encapsulates file attachment information"""
 | 
				
			||||||
 | 
					    pass
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class Message:
 | 
				
			||||||
 | 
					    """Encapsulates an email message"""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def __init__(self, subject: str,
 | 
				
			||||||
 | 
					                 recipients: typing.List[str]=None):
 | 
				
			||||||
 | 
					        self.subject = subject
 | 
				
			||||||
 | 
					        self.recipients = recipients or []
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def add_recipient(self, recipient: str):
 | 
				
			||||||
 | 
					        assert isinstance(recipient, str)
 | 
				
			||||||
 | 
					        self.recipients.append(recipient)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class _MailMixin:
 | 
				
			||||||
 | 
					    pass
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class _Mail:
 | 
				
			||||||
 | 
					    pass
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class Mail:
 | 
				
			||||||
 | 
					    """Manages email messaging"""
 | 
				
			||||||
 | 
					    pass
 | 
				
			||||||
@ -0,0 +1,48 @@
 | 
				
			|||||||
 | 
					from setuptools import setup, find_packages
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					with open('README.md') as readme_file:
 | 
				
			||||||
 | 
					    readme = readme_file.read()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					with open('HISTORY.md') as history_file:
 | 
				
			||||||
 | 
					    history = history_file.read()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					requirements = [
 | 
				
			||||||
 | 
					    'apistar',
 | 
				
			||||||
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					setup_requirements = [
 | 
				
			||||||
 | 
					    'pytest-runner',
 | 
				
			||||||
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					test_requirements = [
 | 
				
			||||||
 | 
					    'pytest',
 | 
				
			||||||
 | 
					    'coverage',
 | 
				
			||||||
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					setup(
 | 
				
			||||||
 | 
					    name='apistar_mail',
 | 
				
			||||||
 | 
					    version='0.1.1',
 | 
				
			||||||
 | 
					    description="A simple email Component for APIStar",
 | 
				
			||||||
 | 
					    long_description=readme + '\n\n' + history,
 | 
				
			||||||
 | 
					    author="Drew Bednar",
 | 
				
			||||||
 | 
					    author_email='drew@androiddrew.com',
 | 
				
			||||||
 | 
					    url='https://github.com/androiddrew/apistar-mail',
 | 
				
			||||||
 | 
					    packages=find_packages(include=['apistar_mail']),
 | 
				
			||||||
 | 
					    include_package_data=True,
 | 
				
			||||||
 | 
					    install_requires=requirements,
 | 
				
			||||||
 | 
					    license="MIT license",
 | 
				
			||||||
 | 
					    zip_safe=False,
 | 
				
			||||||
 | 
					    keywords='apistar_mail',
 | 
				
			||||||
 | 
					    classifiers=[
 | 
				
			||||||
 | 
					        'Development Status :: 1 - Pre-Alpha',
 | 
				
			||||||
 | 
					        'Intended Audience :: Developers',
 | 
				
			||||||
 | 
					        'License :: OSI Approved :: MIT License',
 | 
				
			||||||
 | 
					        'Natural Language :: English',
 | 
				
			||||||
 | 
					        'Programming Language :: Python :: 3',
 | 
				
			||||||
 | 
					        'Programming Language :: Python :: 3.5',
 | 
				
			||||||
 | 
					        'Programming Language :: Python :: 3.6',
 | 
				
			||||||
 | 
					    ],
 | 
				
			||||||
 | 
					    test_suite='tests',
 | 
				
			||||||
 | 
					    tests_require=test_requirements,
 | 
				
			||||||
 | 
					    setup_requires=setup_requirements,
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
@ -0,0 +1,21 @@
 | 
				
			|||||||
 | 
					from apistar_mail.mail import Message
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def test_message_init():
 | 
				
			||||||
 | 
					    msg = Message(subject="subject",
 | 
				
			||||||
 | 
					                  recipients=['fake@example.com'])
 | 
				
			||||||
 | 
					    assert msg.subject == "subject"
 | 
				
			||||||
 | 
					    assert msg.recipients == ['fake@example.com']
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def test_empty_recipient_list_init():
 | 
				
			||||||
 | 
					    msg1 = Message(subject="subject")
 | 
				
			||||||
 | 
					    assert msg1.recipients == []
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def test_add_recipient():
 | 
				
			||||||
 | 
					    msg1 = Message(subject="subject")
 | 
				
			||||||
 | 
					    assert msg1.recipients == []
 | 
				
			||||||
 | 
					    msg1.add_recipient('fake@example.com')
 | 
				
			||||||
 | 
					    assert len(msg1.recipients) == 1
 | 
				
			||||||
 | 
					    assert msg1.recipients[0] == 'fake@example.com'
 | 
				
			||||||
					Loading…
					
					
				
		Reference in New Issue