diff --git a/CHANGELOG.md b/CHANGELOG.md index ff44746..08dfac1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,25 +5,6 @@ All notable changes to WuttaMess will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). -## v0.2.0 (2025-01-14) - -### Feat - -- add `util.get_home_path()` function -- add `is_symlink()` and `set_timezone()` util functions -- add `apt.is_installed()` function -- add basic `postgres` module for db setup -- add `ssh` module with `cache_host_key()` function -- add `util.mako_renderer()` function -- add `util` module with `exists()` function -- add basic postfix config helpers - -### Fix - -- add `wutta.purge_email_settings()` for cloning prod DB to test -- add `postgres.dump_db()` function -- add `sync.make_selector()` convenience function - ## v0.1.0 (2024-09-10) ### Feat diff --git a/docs/api/wuttamess.wutta.rst b/docs/api/wuttamess.wutta.rst deleted file mode 100644 index ecb58a5..0000000 --- a/docs/api/wuttamess.wutta.rst +++ /dev/null @@ -1,6 +0,0 @@ - -``wuttamess.wutta`` -=================== - -.. automodule:: wuttamess.wutta - :members: diff --git a/docs/index.rst b/docs/index.rst index 6aec06a..6571493 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -36,4 +36,3 @@ project. api/wuttamess.ssh api/wuttamess.sync api/wuttamess.util - api/wuttamess.wutta diff --git a/pyproject.toml b/pyproject.toml index 5015f74..52b30e6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "hatchling.build" [project] name = "WuttaMess" -version = "0.2.0" +version = "0.1.0" description = "Fabric Automation Helpers" readme = "README.md" authors = [{name = "Lance Edgar", email = "lance@wuttaproject.org"}] diff --git a/src/wuttamess/wutta.py b/src/wuttamess/wutta.py deleted file mode 100644 index 0145542..0000000 --- a/src/wuttamess/wutta.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8; -*- -################################################################################ -# -# WuttaMess -- Fabric Automation Helpers -# Copyright © 2024-2025 Lance Edgar -# -# This file is part of Wutta Framework. -# -# Wutta Framework is free software: you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the Free -# Software Foundation, either version 3 of the License, or (at your option) any -# later version. -# -# Wutta Framework is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -# more details. -# -# You should have received a copy of the GNU General Public License along with -# Wutta Framework. If not, see . -# -################################################################################ -""" -Utilities for Wutta Framework -""" - -from wuttamess import postgres - - -def purge_email_settings(c, dbname, appname='wutta'): - """ - Purge production email settings for a database. - - This can be used when cloning a production app DB to a test - server. The general pattern is: - - * setup test app on test server - * config file should specify test email settings - * clone the production DB to test server - * call this function to purge email settings from test DB - - So the end result should be, the test server app can run and send - emails safely using only what is specified in config file(s), - since none of the production email settings remain in the test DB. - - :param dbname: Name of the database to be updated. - - :param appname: The ``appname`` used to determine setting names. - """ - postgres.sql(c, f"delete from setting where name like '{appname}.email.%.sender';", - database=dbname) - postgres.sql(c, f"delete from setting where name like '{appname}.email.%.to';", - database=dbname) - postgres.sql(c, f"delete from setting where name like '{appname}.email.%.cc';", - database=dbname) - postgres.sql(c, f"delete from setting where name like '{appname}.email.%.bcc';", - database=dbname) diff --git a/tests/test_wutta.py b/tests/test_wutta.py deleted file mode 100644 index 1b8436c..0000000 --- a/tests/test_wutta.py +++ /dev/null @@ -1,26 +0,0 @@ -# -*- coding: utf-8; -*- - -from unittest import TestCase -from unittest.mock import MagicMock, patch, call - -from wuttamess import wutta as mod - - -class TestPurgeEmailSettings(TestCase): - - def test_basic(self): - c = MagicMock() - sql = MagicMock() - postgres = MagicMock(sql=sql) - with patch.object(mod, 'postgres', new=postgres): - mod.purge_email_settings(c, 'testy', appname='wuttatest') - sql.assert_has_calls([ - call(c, "delete from setting where name like 'wuttatest.email.%.sender';", - database='testy'), - call(c, "delete from setting where name like 'wuttatest.email.%.to';", - database='testy'), - call(c, "delete from setting where name like 'wuttatest.email.%.cc';", - database='testy'), - call(c, "delete from setting where name like 'wuttatest.email.%.bcc';", - database='testy'), - ])