def test_fetch_group_albums(self):

        group = GroupFactory(remote_id=GROUP_ID)

        self.assertEqual(Album.objects.count(), 0)

        albums = group.fetch_albums()

        self.assertTrue(len(albums) > 0)
        self.assertEqual(Album.objects.count(), len(albums))
        self.assertEqual(albums[0].group, group)
Exemple #2
0
    def test_fetch_group_albums(self):

        group = GroupFactory(remote_id=GROUP_ID)

        self.assertEqual(Album.objects.count(), 0)

        albums = group.fetch_albums()

        self.assertTrue(len(albums) > 0)
        self.assertEqual(Album.objects.count(), len(albums))
        self.assertEqual(albums[0].group, group)
Exemple #3
0
    def test_fetch_group_albums(self):

        group = GroupFactory(remote_id=GROUP_ID)

        self.assertEqual(Album.objects.count(), 0)

        albums = group.fetch_albums()

        self.assertGreater(len(albums), 0)
        self.assertEqual(Album.objects.count(), len(albums))
        self.assertEqual(albums[0].owner, group)

        # check force ordering
        self.assertItemsEqual(albums, Album.objects.order_by('-updated'))

        # testing `after` parameter
        after = Album.objects.order_by('-updated')[10].updated

        albums_count = Album.objects.count()
        Album.objects.all().delete()
        self.assertEqual(Album.objects.count(), 0)

        albums = group.fetch_albums(after=after)
        self.assertEqual(albums.count(), Album.objects.count())
        self.assertLess(albums.count(), albums_count)

        # testing `before` parameter
        before = Album.objects.order_by('-updated')[5].updated

        albums_count = Album.objects.count()
        Album.objects.all().delete()
        self.assertEqual(Album.objects.count(), 0)

        albums = group.fetch_albums(before=before, after=after)
        self.assertEqual(albums.count(), Album.objects.count())
        self.assertLess(albums.count(), albums_count)
    def test_fetch_group_albums(self):

        group = GroupFactory(remote_id=GROUP_ID)

        self.assertEqual(Album.objects.count(), 0)

        albums = group.fetch_albums()

        self.assertGreater(len(albums), 0)
        self.assertEqual(Album.objects.count(), len(albums))
        self.assertEqual(albums[0].group, group)

        # check force ordering
        self.assertItemsEqual(albums, Album.objects.order_by("-updated"))

        # testing `after` parameter
        after = Album.objects.order_by("-updated")[10].updated

        albums_count = Album.objects.count()
        Album.objects.all().delete()
        self.assertEqual(Album.objects.count(), 0)

        albums = group.fetch_albums(after=after)
        self.assertEqual(albums.count(), Album.objects.count())
        self.assertLess(albums.count(), albums_count)

        # testing `before` parameter
        before = Album.objects.order_by("-updated")[5].updated

        albums_count = Album.objects.count()
        Album.objects.all().delete()
        self.assertEqual(Album.objects.count(), 0)

        albums = group.fetch_albums(before=before, after=after)
        self.assertEqual(albums.count(), Album.objects.count())
        self.assertLess(albums.count(), albums_count)