예제 #1
0
 def get(self, mine_party_appt_guid=None):
     relationships = request.args.get('relationships')
     relationships = relationships.split(',') if relationships else []
     if mine_party_appt_guid:
         mpa = MinePartyAppointment.find_by_mine_party_appt_guid(
             mine_party_appt_guid)
         if not mpa:
             raise NotFound('Mine Party Appointment not found')
         result = mpa.json(relationships=relationships)
     else:
         mine_guid = request.args.get('mine_guid')
         party_guid = request.args.get('party_guid')
         types = request.args.getlist('types')  #list
         mpas = MinePartyAppointment.find_by(
             mine_guid=mine_guid,
             party_guid=party_guid,
             mine_party_appt_type_codes=types)
         result = [x.json(relationships=relationships) for x in mpas]
     return result
예제 #2
0
def test_party_appt_model_find_by(db_session):
    batch_size = 3
    MinePartyAppointmentFactory.create_batch(size=batch_size)

    mine_party_appts = MinePartyAppointment.find_by()
    assert len(mine_party_appts) == batch_size
예제 #3
0
def test_party_appt_model_find_by(test_client, setup_info, auth_headers):
    mine_party_appts = MinePartyAppointment.find_by()
    assert len(mine_party_appts) == MinePartyAppointment.query.count()