forked from TencentBlueKing/bk-user
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 本地目录导入excel支持选择更新-review调整 TencentBlueKing#728
- Loading branch information
1 parent
3099d0d
commit 8b5faf7
Showing
2 changed files
with
36 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -105,7 +105,7 @@ def test_sync_users(self, syncer, pre_create_department, users, make_parser_set, | |
) | ||
|
||
@pytest.mark.parametrize( | ||
"users,titles,expected", | ||
"users,titles,expected,is_overwrite", | ||
[ | ||
( | ||
[ | ||
|
@@ -118,10 +118,11 @@ def test_sync_users(self, syncer, pre_create_department, users, make_parser_set, | |
"bbbb": "[email protected]", | ||
"cccc": "[email protected]", | ||
}, | ||
), | ||
True, | ||
) | ||
], | ||
) | ||
def test_update_existed_users(self, syncer, users, make_parser_set, titles, expected): | ||
def test_update_existed_users(self, syncer, users, make_parser_set, titles, expected, is_overwrite): | ||
"""测试更新已存在用户""" | ||
for u in ["aaaa", "cccc"]: | ||
a = make_simple_profile(username=u, force_create_params={"category_id": syncer.category_id}) | ||
|
@@ -130,7 +131,7 @@ def test_update_existed_users(self, syncer, users, make_parser_set, titles, expe | |
|
||
# TODO: 当前 id 最大值是在 db_sync_manager 初始化时确定的,实际上并不科学 | ||
syncer.db_sync_manager._update_cache() | ||
syncer._sync_users(make_parser_set(titles), users) | ||
syncer._sync_users(make_parser_set(titles), users, is_overwrite=is_overwrite) | ||
for k, v in expected.items(): | ||
assert Profile.objects.get(category_id=syncer.category_id, username=k).email == v | ||
|
||
|