From d708703f81a79d6989ab0cee2c9e20c59d17c2e4 Mon Sep 17 00:00:00 2001 From: Matt Barrs Date: Thu, 6 Mar 2025 12:37:49 +0000 Subject: [PATCH 1/2] fix: add handling for deactivated user --- smartsheet/models/enums/user_status.py | 1 + tests/integration/test_model_attributes.py | 34 ++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/smartsheet/models/enums/user_status.py b/smartsheet/models/enums/user_status.py index 6a66e57f..f8cd6f0b 100644 --- a/smartsheet/models/enums/user_status.py +++ b/smartsheet/models/enums/user_status.py @@ -21,3 +21,4 @@ class UserStatus(Enum): ACTIVE = 1 PENDING = 2 DECLINED = 3 + DEACTIVATED = 4 diff --git a/tests/integration/test_model_attributes.py b/tests/integration/test_model_attributes.py index 8ab01b6f..398e3c66 100644 --- a/tests/integration/test_model_attributes.py +++ b/tests/integration/test_model_attributes.py @@ -2043,6 +2043,40 @@ def test_user_profile(self, smart_setup): as_dict = model.to_dict() assert isinstance(as_dict, dict) + def test_deactivated_user(self, smart_setup): + smart = smart_setup['smart'] + model = smart.models.UserProfile({ + 'account': smart.models.Account(), + 'admin': True, + 'email': 'foo', + 'firstName': 'foo', + 'groupAdmin': True, + 'id': 19082, + 'lastName': 'foo', + 'licensedSheetCreator': True, + 'locale': 'foo', + 'resourceViewer': True, + 'status': 'DEACTIVATED', + 'timeZone': 'foo' + }) + + assert isinstance(model.account, smart.models.Account) + assert model.admin == True + assert model.email == 'foo' + assert model.first_name == 'foo' + assert model.group_admin == True + assert model.id == 19082 + assert model.last_name == 'foo' + assert model.licensed_sheet_creator == True + assert model.locale == 'foo' + assert model.resource_viewer == True + assert model.status == 'DEACTIVATED' + assert model.time_zone == 'foo' + model.account = {} + assert isinstance(model.account, smart.models.Account) + as_dict = model.to_dict() + assert isinstance(as_dict, dict) + def test_user_profile_snake(self, smart_setup): smart = smart_setup['smart'] model = smart.models.UserProfile({ From 402beb6e16c92b87169b729b7308b46b7d403343 Mon Sep 17 00:00:00 2001 From: Matt Barrs Date: Mon, 10 Mar 2025 17:27:33 +0000 Subject: [PATCH 2/2] add changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 48ac92b5..8ecf7b9c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project 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). +## [3.0.5] - 2025-03-10 + +### Fixed + +- fix for [issue 41](https://github.com/smartsheet/smartsheet-python-sdk/issues/41) Deactivated users have status None + ## [3.0.4] - 2024-07-29 ### Changed