def test_from_livejournal(self): data = fixture_data('from_livejournal.atom') ndix = nested_dicts_from_atom(data) self.assertDictContainsSubsetRecursive({ 'entries': [ { 'id': 'urn:lj:livejournal.com:atom1:damiancugley:105302', 'published': '2010-11-21T18:08:48Z', 'href': 'http://damiancugley.livejournal.com/105302.html', 'title': 'Sister in Storage', 'content': 'Mum was visiting from Malta\u2014her current home, ' 'since that is where her yacht is\u2014and so naturally Saturday found her ' 'and my brother and me down at Big Yellow Self-Storage to collect my sister ' 'Rachel’s gear from there for transfer to the Big Yellow in Guildford, where ' 'she lives. The store is all bare metal and bright yellow paint, so I took the ' 'opportunity to take some photos of Mike and Rachel in this odd environment.', }, { 'title': 'Family time' }, { 'title': 'Ian Cugley, 1945–2010' } ] }, ndix)
def test_from_flickr(self): data = fixture_data('from_flickr_2012.atom') ndix = nested_dicts_from_atom(data, group_by='published') self.assertDictContainsSubsetRecursive({ 'entryGroups': [ { 'published': '2012-11-29T18:36:38Z', 'entries': [ { 'title': 'Set Type (Reversed)', 'href': 'http://www.flickr.com/photos/pdc/8229589533/', 'square': {'href': 'http://farm9.staticflickr.com/8483/8229589533_681832d5ef_s.jpg'}, 'thumbnail': {'href': 'http://farm9.staticflickr.com/8483/8229589533_681832d5ef_t.jpg'}, 'enclosure': { 'href': 'http://farm9.staticflickr.com/8483/8229589533_681832d5ef_b.jpg', } }, {'title': 'Set Type'}, {'title': 'Font Menu'} ] }, { 'published': '2012-11-22T19:40:17Z', 'entries': [ {'title': 'Baroness Orczy, By the Gods Beloved'}, {'title': 'Is the Any Better Recommendation than the name of Orczy'}, ] } ] }, ndix)
def test_from_youtube(self): data = fixture_data('from_youtube.atom') ndix = nested_dicts_from_atom(data) self.assertDictContainsSubsetRecursive({ 'entries': [ { 'id': 'tag:youtube.com,2008:video:49cy7-hTAb4', 'published': '2010-10-31T11:45:25.000Z', 'href': 'http://www.youtube.com/watch?v=49cy7-hTAb4&feature=youtube_gdata', 'title': 'Minehouse 8: Before-Hallowe\'en Tour', 'content': 'Recorded the day before the much-anticipated Hallowe'en update. ' 'As I contemplate the possibility of exploring my world a little more now biomes are to be ' 'added to the mix, I thought this was as good a time as any to review my existing home ' 'base(s). Warning: I don't have any startling megastructures, so people who ' 'don't know me may not find much to hold their interest.', 'poster': { 'href': 'http://i.ytimg.com/vi/49cy7-hTAb4/default.jpg', } }, ] }, ndix)
def setUp(self): data = fixture_data('from_github.atom') self.result = nested_dicts_from_atom(data)