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
8e5d4ee9
Commit
8e5d4ee9
authored
Jun 29, 2020
by
Tomas Taraba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
3386 Add tests with and without user association
parent
da8e95a3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
3 deletions
+25
-3
xivo_dao/resources/labels/dao.py
xivo_dao/resources/labels/dao.py
+1
-2
xivo_dao/resources/labels/tests/test_dao.py
xivo_dao/resources/labels/tests/test_dao.py
+24
-1
No files found.
xivo_dao/resources/labels/dao.py
View file @
8e5d4ee9
...
...
@@ -14,10 +14,9 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>
from
xivo_dao.alchemy.labels
import
Labels
from
xivo_dao.helpers.db_manager
import
daosession
from
xivo_dao.helpers.db_manager
import
Session
from
xivo_dao.helpers.db_manager
import
daosession
from
xivo_dao.resources.labels.search
import
label_search
from
xivo_dao.resources.utils.search
import
SearchResult
...
...
xivo_dao/resources/labels/tests/test_dao.py
View file @
8e5d4ee9
...
...
@@ -14,10 +14,12 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>
from
hamcrest
import
assert_that
,
equal_to
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.u
tils.search
import
SearchResult
from
xivo_dao.resources.u
ser
import
dao
as
user_dao
class
TestLabelExist
(
DAOTestCase
):
...
...
@@ -33,3 +35,24 @@ class TestLabelExist(DAOTestCase):
result
=
label_dao
.
exists
(
label_row
.
id
)
assert_that
(
result
,
equal_to
(
True
))
def
test_get_all_labels
(
self
):
label_row
=
self
.
add_label
()
result
=
label_dao
.
search
()
expected
=
SearchResult
(
total
=
1
,
items
=
[
label_row
])
assert_that
(
result
[
1
][
0
].
users_count
,
equal_to
(
0
))
assert_that
(
result
,
equal_to
(
expected
))
def
test_get_all_labels_with_associated_user
(
self
):
label_row
=
self
.
add_label
()
user
=
self
.
add_user
(
callerid
=
'"John Doe"'
)
user
.
labels
.
append
(
label_row
)
result
=
label_dao
.
search
()
expected
=
SearchResult
(
total
=
1
,
items
=
[
label_row
])
assert_that
(
result
[
1
][
0
].
users_count
,
equal_to
(
1
))
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