Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bob
bob.db.kboc16
Commits
82ec5716
Commit
82ec5716
authored
Feb 08, 2016
by
mgbarrero
Browse files
fixes on queries and readme
parent
64b1f2da
Changes
2
Hide whitespace changes
Inline
Side-by-side
bob/db/kboc16/query.py
View file @
82ec5716
...
...
@@ -84,14 +84,14 @@ class Database(bob.db.verification.utils.SQLiteDatabase,bob.db.verification.util
q
=
q
.
order_by
(
Client
.
id
)
return
list
(
q
)
def
models
(
self
,
protocol
=
None
,
groups
=
None
):
def
models
(
self
,
protocol
=
None
,
groups
=
'eval'
):
"""Returns a list of :py:class:`.Client` for the specific query by the user.
Models correspond to Clients for this database (At most one model per identity).
Keyword Parameters:
protocol
Ignored
.
'A' or 'D'
.
groups
The groups to which the subjects attached to the models belong ('Genuine')
...
...
@@ -105,7 +105,11 @@ class Database(bob.db.verification.utils.SQLiteDatabase,bob.db.verification.util
#groups = self.check_parameters_for_validity(groups, "group", ('Genuine',))
# List of the clients
q
=
self
.
query
(
Client
)
#q = self.query(Client)
if
(
protocol
):
q
=
self
.
query
(
Client
).
join
(
File
).
join
((
ProtocolPurpose
,
File
.
protocolPurposes
)).
join
(
Protocol
).
filter
(
and_
(
Protocol
.
name
.
in_
((
protocol
,)),
ProtocolPurpose
.
sgroup
.
in_
((
groups
,))))
else
:
q
=
self
.
query
(
Client
)
"""if groups:
q = q.filter(Client.stype.in_(groups))
else:
...
...
bob/db/kboc16/test.py
View file @
82ec5716
...
...
@@ -29,6 +29,14 @@ class kboc16DatabaseTest(unittest.TestCase):
assert
len
(
db
.
clients
(
groups
=
'eval'
))
==
300
assert
len
(
db
.
models
())
==
300
assert
len
(
db
.
models
(
groups
=
'eval'
))
==
300
assert
len
(
db
.
models
(
protocol
=
'A'
,
groups
=
'eval'
))
==
300
assert
len
(
db
.
models
(
protocol
=
'A'
))
==
300
assert
len
(
db
.
models
(
protocol
=
'D'
,
groups
=
'eval'
))
==
100
assert
len
(
db
.
models
(
protocol
=
'D'
))
==
100
assert
not
u
'101'
in
[
x
.
id
for
x
in
db
.
models
(
protocol
=
'D'
,
groups
=
'eval'
)]
assert
u
'1'
in
[
x
.
id
for
x
in
db
.
models
(
protocol
=
'D'
,
groups
=
'eval'
)]
assert
u
'100'
in
[
x
.
id
for
x
in
db
.
models
(
protocol
=
'D'
,
groups
=
'eval'
)]
def
test_objects
(
self
):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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