"""
testfixtures.user
~~~~~~~~~~~~~~~~~

:Copyright: 2006-2020 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""

from datetime import date, datetime

from byceps.database import generate_uuid
from byceps.services.user.models.detail import UserDetail
from byceps.services.user import creation_service as user_creation_service


def create_user(
    screen_name='Faith',
    *,
    user_id=None,
    created_at=None,
    email_address=None,
    email_address_verified=False,
    initialized=True,
):
    if not user_id:
        user_id = generate_uuid()

    if not created_at:
        created_at = datetime.utcnow()

    if not email_address:
        email_address = f'user{user_id}@example.com'

    user = user_creation_service.build_user(
        created_at, screen_name, email_address
    )
    user.id = user_id
    user.email_address_verified = email_address_verified
    user.initialized = initialized

    return user


def create_user_with_detail(
    screen_name='Faith',
    *,
    user_id=None,
    email_address=None,
    initialized=True,
    first_names='John Joseph',
    last_name='Doe',
    date_of_birth=None,
):
    user = create_user(
        screen_name,
        user_id=user_id,
        email_address=email_address,
        initialized=initialized,
    )

    detail = UserDetail(user=user)
    detail.first_names = first_names
    detail.last_name = last_name
    detail.date_of_birth = (date_of_birth if date_of_birth else date(1993, 2, 15))
    detail.country = 'State of Mind'
    detail.zip_code = '31337'
    detail.city = 'Atrocity'
    detail.street = 'Elite Street 1337'
    detail.phone_number = '555-CALL-ME-MAYBE'

    return user

@@ -513,16 +513,56 @@
 d=True,%0A
+    suspended=False,%0A    deleted=False,%0A
 ):%0A    i
@@ -965,16 +965,74 @@
 tialized
+%0A    user.suspended = suspended%0A    user.deleted = deleted
 %0A%0A    re
@@ -1164,24 +1164,64 @@
 lized=True,%0A
+    suspended=False,%0A    deleted=False,%0A
     first_na
@@ -1394,16 +1394,16 @@
 ddress,%0A
-
         
@@ -1427,16 +1427,70 @@
 alized,%0A
+        suspended=suspended,%0A        deleted=deleted,%0A
     )%0A%0A 

Allow test fixture helper to create suspended, deleted user accounts