def fetchAndStore(key=None, id=None):
    '''
  Collects data from a class and handles its output either
  by storing it in a database or by constructing an error
  message to be delivered to the user.

  '''
    if key == 'resources':
        data = fetchResourceData(dataset_id=id)
        for resource in data:
            storeData(resource, key)

    else:
        data = fetchClassData(key, id)
        if data:
            storeData(data, key)
def fetchAndStore(key=None, id=None):
  '''
  Collects data from a class and handles its output either
  by storing it in a database or by constructing an error
  message to be delivered to the user.

  '''
  if key == 'resources':
    data = fetchResourceData(dataset_id=id)
    for resource in data:
      storeData(resource, key)

  else:
    data = fetchClassData(key, id)
    if data:
      storeData(data, key)
Beispiel #3
0
  def test_update_works(self):
    '''
    functions.store_data_update:  Test that the data storage updates data properly.

    '''
    storeData(self.data, 'test')
Beispiel #4
0
  def test_data_storage_doesnt_fail(self):
    '''
    functions.store_data_insert:  Test that the data storage inserts data properly.

    '''
    storeData(self.data, 'test')