def update_profile(request): if auth.isLogin(request): uuid = auth.get_user_data(request).uuid user_profile = User_Profiles( username=request.POST["username"], email=request.POST["email"], default_shipping_address=request.POST["shipping_address"], phone_number=request.POST["phone"], real_name=request.POST["realname"], tw_id=request.POST["id"], ) if not auth.hasProfile(uuid): auth.register_data(uuid, user_profile) else: auth.update_data(uuid, user_profile) return redirect("digikey.views.progress_page")
def test_register_profile(self): profile = User_Profiles(username="******", email="*****@*****.**", default_shipping_address="nowhere", phone_number="0000000000", tw_id="A123456789", real_name="DUMMY") auth.register_data("6a8f7800-91ba-11e5-af58-0002a5d5c51b", profile) self.assertEqual(auth.hasProfile("6a8f7800-91ba-11e5-af58-0002a5d5c51b"), True)