def test_match_locations_empty(self): matched = imagehandler._match_locations([], ()) self.assertEqual([], matched) matched = imagehandler._match_locations(None, ()) self.assertEqual([], matched) matched = imagehandler._match_locations([], None) self.assertEqual([], matched)
def test_match_locations_location_dependent(self): fake_locations = [{'url': 'fake1://url', 'metadata': {}}, {'url': 'fake2://url', 'metadata': {}}] matched = imagehandler._match_locations(fake_locations, ('fake1')) self.assertEqual([{'url': 'fake1://url', 'metadata': {}}], matched) matched = imagehandler._match_locations(fake_locations, ('no_existing')) self.assertEqual([], matched)
def test_match_locations_location_independent(self): fake_locations = [{'url': 'fake1://url', 'metadata': {}}, {'url': 'fake2://url', 'metadata': {}}] matched = imagehandler._match_locations(fake_locations, ()) self.assertEqual(fake_locations, matched)