diff --git a/desktop_shop/gui/callbacks.py b/desktop_shop/gui/callbacks.py index a9e8c90..faea54f 100644 --- a/desktop_shop/gui/callbacks.py +++ b/desktop_shop/gui/callbacks.py @@ -50,7 +50,7 @@ def sign_out(): """ gui.app.data = { "session_id": None, - "user_data": user.UserSignUpData(), + "user_data": None, "pw_hash": "", "cart": [], } diff --git a/desktop_shop/gui/init.py b/desktop_shop/gui/init.py index 8aa7dd0..7684a00 100644 --- a/desktop_shop/gui/init.py +++ b/desktop_shop/gui/init.py @@ -7,7 +7,7 @@ import tkinter as tk from typing import Dict -from desktop_shop import gui, user +from desktop_shop import gui from desktop_shop.gui import components, config from desktop_shop.gui.components import Builder, Component, EntryFactory, Factory, Frame from desktop_shop.gui.views import views @@ -62,7 +62,7 @@ def init(): gui.app.views_dict = init_views(gui.root, gui.app.builder) gui.app.data = { "session_id": None, - "user_data": user.UserSignUpData(), + "user_data": None, "pw_hash": "", "cart": [], } diff --git a/desktop_shop/user.py b/desktop_shop/user.py index 9a6d458..b925710 100644 --- a/desktop_shop/user.py +++ b/desktop_shop/user.py @@ -11,13 +11,10 @@ # pylint: disable=function-redefined @dataclass class UserData: - """Stores user data + """Stores user data""" - FIXME: crashes when first_name or last_name are accessed without being set. - """ - - first_name: str = "" - last_name: str = "" + first_name: str + last_name: str gender: str = "" dob: str = "" # date of birth email: str = "" diff --git a/tests/unit/gui/callbacks_test.py b/tests/unit/gui/callbacks_test.py index 341f1ea..9e4105d 100644 --- a/tests/unit/gui/callbacks_test.py +++ b/tests/unit/gui/callbacks_test.py @@ -176,7 +176,7 @@ def test_store_user_data_error(): @pytest.mark.parametrize( "user_data, expected_message_start, expected", [ - (UserSignUpData(), "Email", False), + (UserSignUpData(first_name="a", last_name="b"), "Email", False), (UserSignUpData(email="a@b.c", first_name="1eer3", last_name="2aa4"), "First", False), (UserSignUpData(email="a@b.c", first_name="john", last_name="2bbere4 "), "Last", False), (UserSignUpData(email="a@b.c", first_name="john", last_name="doe"), "", True),