Beispiel #1
0
def get_all_cities(event, context):
    od = OffeneDaten()
    cities = od.get_all_cities()
    cityCount = len(cities)
    city_names = [city["name"] for city in cities]
    data = {
        'job_name': 'get_all_cities',
        'date': datetime.date.today().strftime('%Y-%m-%d'),
        'org_count': cityCount,
        'cities': city_names
    }
    with open('/tmp/get_all_cities.json', 'w') as f:
        json.dump(data, f)
    utils.upload_file_to_s3('get_all_cities.json', '/tmp/get_all_cities.json')
    # start the lambda services
    responses = [collect_cities(city) for city in city_names]
    body = {
        "message": "Go Serverless v1.0! Your function executed successfully!",
        "input": event
    }

    response = {"statusCode": 200, "body": json.dumps(body)}

    return response
Beispiel #2
0
 def test_score_for_update_within_30_days(self):
     od = OffeneDaten()
Beispiel #3
0
 def test_score_for_format_is_machine_radable_but_not_open(self):
     od = OffeneDaten()
     assert od.score_for_format("XLS") == 0.5
Beispiel #4
0
 def test_score_for_format_is_open_and_maschine_readable(self):
     od = OffeneDaten()
     assert od.score_for_format("closed") == 0
Beispiel #5
0
 def test_score_for_format_is_open(self):
     od = OffeneDaten()
     assert od.score_for_format("CSV") == 1
Beispiel #6
0
 def test_score_for_license_is_open(self):
     od = OffeneDaten()
     assert od.score_for_license("closed") == 0
Beispiel #7
0
 def test_score_for_license_is_open(self):
     od = OffeneDaten()
     assert od.score_for_license("cc-by 3.0") == 1
Beispiel #8
0
 def test_get_open_datasets(self):
     od = OffeneDaten()
     package_data = [{"isopen": True}, {"isopen": False}, {"isopen": True}]
     assert len(od.get_open_datasets(package_data)) == 2
Beispiel #9
0
 def test_init(self):
     od = OffeneDaten()
     assert od.org_data == []