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])
def test_search_terms(self): """Test whether the search_fields is properly set""" configure_http_server() finosmeetings = FinosMeetings(MEETINGS_URL) entries = [entry for entry in finosmeetings.fetch()] for e in entries: self.assertEqual(finosmeetings.metadata_id(e['data']), e['search_fields']['item_id'])
def test_fetch_empty(self): """Test whether it works when no entries are fetched""" body = """""" httpretty.register_uri(httpretty.GET, MEETINGS_URL, body=body, status=200) finosmeetings = FinosMeetings(MEETINGS_URL) entries = [entry for entry in finosmeetings.fetch()] self.assertEqual(len(entries), 0)
def test_initialization(self): """Test whether attributes are initializated""" finosmeetings = FinosMeetings(MEETINGS_URL) self.assertTrue(finosmeetings.origin, MEETINGS_URL) self.assertIsNone(finosmeetings.client) self.assertTrue(finosmeetings.ssl_verify) # When ssl_verify is deactivated finosmeetings = FinosMeetings(MEETINGS_URL, ssl_verify=False) self.assertTrue(finosmeetings.origin, MEETINGS_URL) self.assertIsNone(finosmeetings.client) self.assertFalse(finosmeetings.ssl_verify)
def test_initialization(self): """Test whether attributes are initializated""" finosmeetings = FinosMeetings(MEETINGS_URL) self.assertTrue(finosmeetings.origin, MEETINGS_URL) self.assertIsNone(finosmeetings.client)
def test_has_archiving(self): """Test if it returns True when has_archiving is called""" self.assertEqual(FinosMeetings.has_archiving(), False)
def test_has_resuming(self): """Test if it returns False when has_resuming is called""" self.assertEqual(FinosMeetings.has_resuming(), False)