def test_fetch_from_file(self): """Test whether a list of entries is returned from a file definition""" finosmeetings = FinosMeetings( "file://" + file_abs_path('data/finosmeetings/finosmeetings_entries.csv')) entries = [entry for entry in finosmeetings.fetch()] self.assertEqual(len(entries), 3) # Test metadata expected = [('*****@*****.**', 'Rob Underwood', 'brooklynrob', 'Data Tech', 'Data Tech PMC', '2018-09-28'), ('*****@*****.**', 'Tosha Ellison', '', 'Data Tech', 'Security Reference Data', '2018-12-11'), ('*****@*****.**', 'Maurizio Pillitu', 'maoo', 'FDC3', 'FDC3 PMC', '2018-10-19')] for x in range(len(expected)): entry = entries[x]['data'] self.assertEqual(entries[x]['uuid'], uuid(finosmeetings.origin, FinosMeetings.metadata_id(entry))) self.assertEqual(entries[x]['updated_on'], FinosMeetings.metadata_updated_on(entry)) self.assertEqual(entry['email'], expected[x][0]) self.assertEqual(entry['name'], expected[x][1]) self.assertEqual(entry['org'], 'FINOS') self.assertEqual(entry['githubid'], expected[x][2]) self.assertEqual(entry['program'], expected[x][3]) self.assertEqual(entry['activity'], expected[x][4]) self.assertEqual(entry['date'], expected[x][5])
def test_fetch(self): """Test whether a list of entries is returned""" http_requests = configure_http_server() finosmeetings = FinosMeetings(MEETINGS_URL) entries = [entry for entry in finosmeetings.fetch()] self.assertEqual(len(entries), 3) self.assertEqual(len(http_requests), 1) # Test metadata expected = [('*****@*****.**', 'Rob Underwood', 'brooklynrob', 'Data Tech', 'Data Tech PMC', '2018-09-28'), ('*****@*****.**', 'Tosha Ellison', '', 'Data Tech', 'Security Reference Data', '2018-12-11'), ('*****@*****.**', 'Maurizio Pillitu', 'maoo', 'FDC3', 'FDC3 PMC', '2018-10-19')] for x in range(len(expected)): entry = entries[x]['data'] self.assertEqual(entries[x]['uuid'], uuid(finosmeetings.origin, FinosMeetings.metadata_id(entry))) self.assertEqual(entries[x]['updated_on'], FinosMeetings.metadata_updated_on(entry)) self.assertEqual(entry['email'], expected[x][0]) self.assertEqual(entry['name'], expected[x][1]) self.assertEqual(entry['org'], 'FINOS') self.assertEqual(entry['githubid'], expected[x][2]) self.assertEqual(entry['program'], expected[x][3]) self.assertEqual(entry['activity'], expected[x][4]) self.assertEqual(entry['date'], expected[x][5])