remove hardcoded SQL queries in tests
remove hardcoded SQL queries in tests

There are several occurrences of hardcoded SQL queries in tests.
Due to variations in databases these queries might not work all
the time, and should be replaced by queries built with sqlalchemy.

Change-Id: Id0198ea03087ab4acc7eebf0e4d12a37e3437382
Closes-Bug: #1287637

ging/keystone,roopali8/keystone,rushiagr/keystone,promptworks/keystone,blueboxgroup/keystone,reeshupatel/demo,blueboxgroup/keystone,roopali8/keystone,himanshu-setia/keystone,rodrigods/keystone,dims/keystone,JioCloud/keystone,dstanek/keystone,idjaw/keystone,ilay09/keystone,vivekdhayaal/keystone,JioCloud/keystone,jumpstarter-io/keystone,dstanek/keystone,ilay09/keystone,promptworks/keystone,reeshupatel/demo,vivekdhayaal/keystone,MaheshIBM/keystone,maestro-hybrid-cloud/keystone,ging/keystone,vivekdhayaal/keystone,jamielennox/keystone,mahak/keystone,rajalokan/keystone,mahak/keystone,klmitch/keystone,idjaw/keystone,reeshupatel/demo,jumpstarter-io/keystone,nuxeh/keystone,rodrigods/keystone,himanshu-setia/keystone,ajayaa/keystone,maestro-hybrid-cloud/keystone,dstanek/keystone,klmitch/keystone,rushiagr/keystone,cernops/keystone,rushiagr/keystone,jumpstarter-io/keystone,rajalokan/keystone,promptworks/keystone,openstack/keystone,takeshineshiro/keystone,mahak/keystone,jamielennox/keystone,MaheshIBM/keystone,ilay09/keystone,UTSA-ICS/keystone-kerberos,ajayaa/keystone,nuxeh/keystone,takeshineshiro/keystone,rajalokan/keystone,cernops/keystone,UTSA-ICS/keystone-kerberos,nuxeh/keystone,openstack/keystone,dims/keystone,openstack/keystone,jonnary/keystone,jonnary/keystone