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
bfaddad1
Commit
bfaddad1
authored
Aug 10, 2020
by
Etienne Allovon
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into 3392-update-label
parents
51ecfd91
c7b6f71d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
1 deletion
+29
-1
debian/changelog
debian/changelog
+5
-1
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
+17
-0
No files found.
debian/changelog
View file @
bfaddad1
xivo-dao (2020.14.00) xivo-freya; urgency=medium
[Tomas Taraba]
* 3438 Disassociate users from label when the label is deleted
[Rim Jamali]
* 3392 update labels API
--
Rim Jamali <rjamali@xivo.solutions> Wed, 05 Aug 2020 10:36:53
+0200
--
Tomas Taraba <ttaraba@avencall.com> Tue, 04 Aug 2020 16:14:32
+0200
xivo-dao (2020.13.00) xivo-freya; urgency=medium
...
...
xivo_dao/resources/labels/dao.py
View file @
bfaddad1
...
...
@@ -55,10 +55,17 @@ def edit(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 @
bfaddad1
...
...
@@ -91,6 +91,23 @@ class TestLabelCRUD(DAOTestCase):
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
))
assert_that
(
len
(
result_user
.
labels
),
equal_to
(
0
))
def
test_edit_label
(
self
):
label
=
self
.
add_label
()
label
.
display_name
=
'MyLabel'
...
...
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