Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
6
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
2f4bb2cd
Commit
2f4bb2cd
authored
Jul 10, 2020
by
Laurent Meiller
Browse files
Options
Browse Files
Download
Plain Diff
Merge from master
parents
b98d44d6
c5a79321
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
3 deletions
+24
-3
debian/changelog
debian/changelog
+1
-0
xivo_dao/resources/labels/dao.py
xivo_dao/resources/labels/dao.py
+11
-0
xivo_dao/resources/labels/tests/test_dao.py
xivo_dao/resources/labels/tests/test_dao.py
+12
-3
No files found.
debian/changelog
View file @
2f4bb2cd
xivo-dao (2020.12.00) xivo-freya; urgency=medium
* Bump target version to 2020.12
* 3386 Add delete labels api
-- tmourier <tmourier@avencall.com> Mon, 06 Jul 2020 14:47:46 +0200
...
...
xivo_dao/resources/labels/dao.py
View file @
2f4bb2cd
...
...
@@ -39,6 +39,17 @@ def create(label):
Session
.
flush
()
return
label
def
create
(
label
):
Session
.
add
(
label
)
Session
.
flush
()
return
label
def
delete
(
label
):
Session
.
delete
(
label
)
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 @
2f4bb2cd
...
...
@@ -16,11 +16,10 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>
from
hamcrest
import
assert_that
,
equal_to
from
xivo_dao.alchemy.labels
import
Labels
from
xivo_dao.resources.labels
import
dao
as
label_dao
from
xivo_dao.resources.utils.search
import
SearchResult
from
xivo_dao.tests.test_dao
import
DAOTestCase
from
xivo_dao.resources.labels
import
dao
as
label_dao
from
xivo_dao.resources.user
import
dao
as
user_dao
from
xivo_dao.alchemy.labels
import
Labels
class
TestLabelExist
(
DAOTestCase
):
...
...
@@ -68,3 +67,13 @@ class TestLabelExist(DAOTestCase):
assert_that
(
result
[
1
][
0
].
users_count
,
equal_to
(
1
))
assert_that
(
result
,
equal_to
(
expected
))
def
test_delete_label
(
self
):
label_row
=
self
.
add_label
()
label_dao
.
delete
(
label_row
)
expected
=
SearchResult
(
total
=
0
,
items
=
[])
result
=
label_dao
.
search
()
assert_that
(
result
,
equal_to
(
expected
))
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