Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
See what's new at GitLab
4
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
X
xivo-dao
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Labels
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xivo.solutions
xivo-dao
Commits
63887809
Commit
63887809
authored
Aug 04, 2020
by
Tomas Taraba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
3438 Disassociate users from label, when label is deleted
parent
cb12deab
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
0 deletions
+23
-0
xivo_dao/resources/labels/dao.py
xivo_dao/resources/labels/dao.py
+7
-0
xivo_dao/resources/labels/tests/test_dao.py
xivo_dao/resources/labels/tests/test_dao.py
+16
-0
No files found.
xivo_dao/resources/labels/dao.py
View file @
63887809
...
...
@@ -49,10 +49,17 @@ def create(label):
def
delete
(
label
):
label
=
get
(
label
.
id
)
_disassociate
(
label
)
Session
.
delete
(
label
)
Session
.
flush
()
def
_disassociate
(
label
):
label
.
user_features
=
[]
Session
.
flush
()
def
search
(
**
parameters
):
rows
,
total
=
label_search
.
search
(
Session
,
parameters
)
return
SearchResult
(
total
,
rows
)
xivo_dao/resources/labels/tests/test_dao.py
View file @
63887809
...
...
@@ -88,3 +88,19 @@ class TestLabelExist(DAOTestCase):
result
=
label_dao
.
search
()
assert_that
(
result
,
equal_to
(
expected
))
def
test_delete_associated_label
(
self
):
label_row
=
self
.
add_label
()
user
=
self
.
add_user
(
callerid
=
'"John Doe"'
)
user
.
labels
.
append
(
label_row
)
label_dao
.
delete
(
label_row
)
expected_label
=
SearchResult
(
total
=
0
,
items
=
[])
result_label
=
label_dao
.
search
()
result_user
=
user_dao
.
find_by_id_uuid
(
user
.
id
)
assert_that
(
result_label
,
equal_to
(
expected_label
))
assert_that
(
result_user
.
id
,
equal_to
(
user
.
id
))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment