smtp-test-server


Namesmtp-test-server JSON
Version 0.1.0 PyPI version JSON
download
home_pagehttps://git.codebau.dev/jed/smtp-test-server
SummarySimple SMTP test server for running unit and integration tests.
upload_time2023-12-03 09:19:24
maintainer
docs_urlNone
authorJuergen Edelbluth
requires_python>=3.11,<4.0
licenseMIT
keywords test unittest integrationtest mail smtp mock
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # smtp-test-server

Based on the [`aiosmtpd`](https://github.com/aio-libs/aiosmtpd), this packages offers you a simple way to integrate
a SMTP server into your test code.

Currently, the server does not support authentication, TLS or anything special instead of sending mails.

All mails are collected in the `messages` property of the mock and can be evaluated there.

Looking for a `pytest` SMTP mock fixture? Take a look at this project:
[git.codebau.dev/pytest-plugins/pytest-smtp-test-server](https://git.codebau.dev/pytest-plugins/pytest-smtp-test-server).

## Installation

### Installation with "pip"

```Bash
pip install smtp-test-server
```

### Installation with "poetry"

```Bash
poetry add --group dev smtp-test-server
```

## Usage

Simple usage, with auto assigning a free port number on `127.0.0.1`:

```Python
from smtp_test_server.context import SmtpMockServer

def test_send_mail():
    with SmtpMockServer() as smtp_mock:
        my_mail_method(smtp_host=smtp_mock.host, smtp_port=smtp_mock.port)
    assert len(smtp_mock.messages) == 1
    assert smtp_mock.messages[0]["from"] == "my-test@sender.org"
```

Want to have more control over host and port? Use it like this:

```Python
with SmtpMockServer(bind_host="223.12.9.177", bind_port=2525):
    ...
```

Ports are automatically closed when leaving the context.

            

Raw data

            {
    "_id": null,
    "home_page": "https://git.codebau.dev/jed/smtp-test-server",
    "name": "smtp-test-server",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.11,<4.0",
    "maintainer_email": "",
    "keywords": "test,unittest,integrationtest,mail,smtp,mock",
    "author": "Juergen Edelbluth",
    "author_email": "smtp-test-server@jued.de",
    "download_url": "https://files.pythonhosted.org/packages/af/80/230bfaf67256ca5a9189e070d80a6547dbadbeb1fa0cdf8d60e616679297/smtp_test_server-0.1.0.tar.gz",
    "platform": null,
    "description": "# smtp-test-server\n\nBased on the [`aiosmtpd`](https://github.com/aio-libs/aiosmtpd), this packages offers you a simple way to integrate\na SMTP server into your test code.\n\nCurrently, the server does not support authentication, TLS or anything special instead of sending mails.\n\nAll mails are collected in the `messages` property of the mock and can be evaluated there.\n\nLooking for a `pytest` SMTP mock fixture? Take a look at this project:\n[git.codebau.dev/pytest-plugins/pytest-smtp-test-server](https://git.codebau.dev/pytest-plugins/pytest-smtp-test-server).\n\n## Installation\n\n### Installation with \"pip\"\n\n```Bash\npip install smtp-test-server\n```\n\n### Installation with \"poetry\"\n\n```Bash\npoetry add --group dev smtp-test-server\n```\n\n## Usage\n\nSimple usage, with auto assigning a free port number on `127.0.0.1`:\n\n```Python\nfrom smtp_test_server.context import SmtpMockServer\n\ndef test_send_mail():\n    with SmtpMockServer() as smtp_mock:\n        my_mail_method(smtp_host=smtp_mock.host, smtp_port=smtp_mock.port)\n    assert len(smtp_mock.messages) == 1\n    assert smtp_mock.messages[0][\"from\"] == \"my-test@sender.org\"\n```\n\nWant to have more control over host and port? Use it like this:\n\n```Python\nwith SmtpMockServer(bind_host=\"223.12.9.177\", bind_port=2525):\n    ...\n```\n\nPorts are automatically closed when leaving the context.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Simple SMTP test server for running unit and integration tests.",
    "version": "0.1.0",
    "project_urls": {
        "Changelog": "https://git.codebau.dev/jed/smtp-test-server/CHANGELOG.md",
        "Documentation": "https://git.codebau.dev/jed/smtp-test-server",
        "Homepage": "https://git.codebau.dev/jed/smtp-test-server",
        "Issue Tracker": "https://git.codebau.dev/jed/smtp-test-server/issues",
        "Releases": "https://git.codebau.dev/jed/smtp-test-server/releases",
        "Repository": "https://git.codebau.dev/jed/smtp-test-server",
        "Wiki": "https://git.codebau.dev/jed/smtp-test-server/wiki"
    },
    "split_keywords": [
        "test",
        "unittest",
        "integrationtest",
        "mail",
        "smtp",
        "mock"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6fb8a1487ec4a2287308ca8e445fc9f416885beca11cab3879401cc15623ab92",
                "md5": "e9d272a9c68fb5e6e0d920d9c3829dbd",
                "sha256": "d19387bf1e7f53b0c1ceedb9e8dd6147d0189bae93ccd90145c278c6a97919c6"
            },
            "downloads": -1,
            "filename": "smtp_test_server-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e9d272a9c68fb5e6e0d920d9c3829dbd",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11,<4.0",
            "size": 5751,
            "upload_time": "2023-12-03T09:19:12",
            "upload_time_iso_8601": "2023-12-03T09:19:12.245766Z",
            "url": "https://files.pythonhosted.org/packages/6f/b8/a1487ec4a2287308ca8e445fc9f416885beca11cab3879401cc15623ab92/smtp_test_server-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "af80230bfaf67256ca5a9189e070d80a6547dbadbeb1fa0cdf8d60e616679297",
                "md5": "b2cceaae69aa094e1bca03e27b48ba3f",
                "sha256": "b64ee81af6cb2a44031ce2b9f885faeeb76f088d9c7bcfcee4d11751ea5d9aa6"
            },
            "downloads": -1,
            "filename": "smtp_test_server-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "b2cceaae69aa094e1bca03e27b48ba3f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11,<4.0",
            "size": 5085,
            "upload_time": "2023-12-03T09:19:24",
            "upload_time_iso_8601": "2023-12-03T09:19:24.984367Z",
            "url": "https://files.pythonhosted.org/packages/af/80/230bfaf67256ca5a9189e070d80a6547dbadbeb1fa0cdf8d60e616679297/smtp_test_server-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-03 09:19:24",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "smtp-test-server"
}
        
Elapsed time: 0.25252s