def toPrimeContract(soapDict): modelAttrs = flattenSoapDict(_primeContract, _contractAddrs, 'bus_types', soapDict) modelAttrs['subawards'] = [ toSubcontract(sub) for sub in soapDict.get('subcontractors', []) ] return FSRSProcurement(**modelAttrs)
def to_prime_contract(soap_dict): model_attrs = flatten_soap_dict(_primeContract, _contractAddrs, 'bus_types', soap_dict) model_attrs['subawards'] = [to_subcontract(sub) for sub in soap_dict.get('subcontractors', [])] debug_dict = {'id': model_attrs['id'], 'internal_id': model_attrs['internal_id'], 'subaward_count': len(model_attrs['subawards'])} logger.debug('Procurement: %s' % str(debug_dict)) return FSRSProcurement(**model_attrs)
def test_next_id(no_award_db): no_award_db.add_all([ FSRSProcurementFactory(id=5), FSRSProcurementFactory(id=3), FSRSGrantFactory(id=2) ]) no_award_db.commit() assert 6 == FSRSProcurement.next_id(no_award_db) assert 3 == FSRSGrant.next_id(no_award_db)
def to_prime_contract(soap_dict): """ Extracts Prime Contract object from soap dictionary Args: soap_dict: soap dictionary to parse Returns: Prime Contract object """ model_attrs = flatten_soap_dict(_primeContract, _contractAddrs, 'bus_types', soap_dict) model_attrs['subawards'] = [to_subcontract(sub) for sub in soap_dict.get('subcontractors', [])] debug_dict = {'id': model_attrs['id'], 'internal_id': model_attrs['internal_id'], 'subaward_count': len(model_attrs['subawards'])} logger.debug('Procurement: %s' % str(debug_dict)) return FSRSProcurement(**model_attrs)
def test_next_id(no_award_db): no_award_db.add_all([FSRSProcurementFactory(id=5), FSRSProcurementFactory(id=3), FSRSGrantFactory(id=2)]) no_award_db.commit() assert 6 == FSRSProcurement.next_id(no_award_db) assert 3 == FSRSGrant.next_id(no_award_db)
def test_next_id_default(no_award_db): assert FSRSProcurement.next_id(no_award_db) == 0