'Tests that a filter with `conjoined=True` returns objects that
have all the values included in `value`. For example filter
users that have all of this books.'

def test_filter_conjoined_true(self):

    book_kwargs = {u'price': 1, u'average_rating': 1}
    books = []
    books.append(Book.objects.create(**book_kwargs))
    books.append(Book.objects.create(**book_kwargs))
    books.append(Book.objects.create(**book_kwargs))
    books.append(Book.objects.create(**book_kwargs))
    books.append(Book.objects.create(**book_kwargs))
    books.append(Book.objects.create(**book_kwargs))
    user1 = User.objects.create()
    user2 = User.objects.create()
    user3 = User.objects.create()
    user4 = User.objects.create()
    user5 = User.objects.create()
    user1.favorite_books.add(books[0], books[1])
    user2.favorite_books.add(books[0], books[1], books[2])
    user3.favorite_books.add(books[1], books[2])
    user4.favorite_books.add(books[2], books[3])
    user5.favorite_books.add(books[4], books[5])
    filter_list = (((books[0].pk, books[0].pk), [1, 2]), ((books[1].pk, books[1].pk), [1, 2, 3]), ((books[2].pk, books[2].pk), [2, 3, 4]), ((books[3].pk, books[3].pk), [4]), ((books[4].pk, books[4].pk), [5]), ((books[0].pk, books[1].pk), [1, 2]), ((books[0].pk, books[2].pk), [2]), ((books[1].pk, books[2].pk), [2, 3]), ((books[2].pk, books[3].pk), [4]), ((books[4].pk, books[5].pk), [5]), ((books[3].pk, books[4].pk), []))
    users = User.objects.all()
    for item in filter_list:
        f = MultipleChoiceFilter(name=u'favorite_books__pk', conjoined=True)
        queryset = f.filter(users, item[0])
        expected_pks = [c[0] for c in queryset.values_list(u'pk')]
        self.assertListEqual(expected_pks, item[1], u'Lists    Differ:    {0}    !=    {1}    for    case    {2}'.format(expected_pks, item[1], item[0]))
