def test_importer_imports_data_correctly(gists_database, mocked_requests): import_gists_to_database(gists_database, 'gvanrossum') query = 'SELECT COUNT(*) FROM gists;' cursor = gists_database.execute(query) count = cursor.fetchone()[0] assert count == 7 for testing_gist_path in TESTING_GISTS_PATHS: with open(testing_gist_path, 'r') as fp: gist_data = json.load(fp) _test_gist_from_json(gists_database, gist_data)
def test_import_with_non_existent_user_raises(gists_database, mocked_requests): with pytest.raises(exceptions.HTTPError): import_gists_to_database(gists_database, 'rmotr-doesnt-exist')
from gists_database.importer import import_gists_to_database from pprint import pprint pprint(import_gists_to_database('gvanrossum'))