Commit 3ee1bf7f authored by mgbarrero's avatar mgbarrero

new protocol added

parent 0721fb2a
......@@ -63,7 +63,8 @@ def add_protocols(session, verbose):
# 1. DEFINITIONS
enroll_session = [1]
client_probe_session = [2]
protocols = ['A']
protocols = ['A','D']
client_ids_protD = range(1,101)
# 2. ADDITIONS TO THE SQL DATABASE
protocolPurpose_list = [('eval', 'enrol'), ('eval', 'probe')]
......@@ -87,13 +88,19 @@ def add_protocols(session, verbose):
# Add files attached with this protocol purpose
if(key == 0): #test enrol
q = session.query(File).join(Client).filter(File.session_id.in_(enroll_session))
if proto == 'D':
q = session.query(File).join(Client).filter(Client.id.in_(client_ids_protD)).filter(File.session_id.in_(enroll_session))
else:
q = session.query(File).join(Client).filter(File.session_id.in_(enroll_session))
for k in q:
if verbose>1: print(" Adding protocol file '%s'..." % (k.path))
pu.files.append(k)
elif(key == 1): #test probe
q = session.query(File).join(Client).filter(File.session_id.in_(client_probe_session))
if (proto == 'D'):
q = session.query(File).join(Client).filter(Client.id.in_(client_ids_protD)).filter(File.session_id.in_(client_probe_session))
else:
q = session.query(File).join(Client).filter(File.session_id.in_(client_probe_session))
for k in q:
if verbose>1: print(" Adding protocol file '%s'..." % (k.path))
pu.files.append(k)
......
......@@ -44,6 +44,17 @@ class kboc16DatabaseTest(unittest.TestCase):
assert len(db.objects(protocol='A', groups='eval', purposes='probe', model_ids=[1], classes='client')) == 20
assert len(db.objects(protocol='A', groups='eval', purposes='probe', model_ids=[1,2])) == 40
assert len(db.objects(protocol='A', groups='eval', purposes='probe', model_ids=[1,2], classes='client')) == 40
# D
assert len(db.objects(protocol='D')) == 2400
assert len(db.objects(protocol='D', groups='eval')) == 2400
assert len(db.objects(protocol='D', groups='eval', purposes='enrol')) == 400
assert len(db.objects(protocol='D', groups='eval', purposes='probe')) == 2000
assert len(db.objects(protocol='D', groups='eval', purposes='probe', classes='client')) == 2000
assert len(db.objects(protocol='D', groups='eval', purposes='probe', model_ids=[1])) == 20
assert len(db.objects(protocol='D', groups='eval', purposes='probe', model_ids=[1], classes='client')) == 20
assert len(db.objects(protocol='D', groups='eval', purposes='probe', model_ids=[1,2])) == 40
assert len(db.objects(protocol='D', groups='eval', purposes='probe', model_ids=[1,2], classes='client')) == 40
def test_driver_api(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment