Skip to content

ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.

test(wordpress): seed the HA drift fixture through make_application

Juan Denis1dfd5f52c15c
diff --git a/backend/tests/test_wordpress_ha_foundations.py b/backend/tests/test_wordpress_ha_foundations.py
index 88e2ba07..7b934181 100644
--- a/backend/tests/test_wordpress_ha_foundations.py
+++ b/backend/tests/test_wordpress_ha_foundations.py
@@ -159,31 +159,18 @@ def test_generic_docker_application_does_not_enable_wordpress_protection():
def test_existing_wordpress_site_drift_target_includes_protection(app):
from app import db
- from app.models import Application, User
from app.models.domain import Domain
from app.services.drift_service import _nginx_render_expected
- from werkzeug.security import generate_password_hash
-
- owner = User(
- username='wp-drift-owner',
- password_hash=generate_password_hash('x'),
- role=User.ROLE_ADMIN,
- is_active=True,
- )
- db.session.add(owner)
- db.session.commit()
- wordpress = Application(
+ from tests.factories import make_application
+
+ wordpress = make_application(
+ db,
name='existing-wp',
- app_type='docker',
status='running',
root_path='/srv/existing-wp',
docker_image='WordPress',
- user_id=owner.id,
port=8500,
)
- db.session.add(wordpress)
- db.session.commit()
db.session.add(Domain(
name='existing-wp.example.com',
is_primary=True,