'Changing products works as expected.'

def test_changing_products(self):

    r = ApprovedRevisionFactory()
    d = r.document
    prod_desktop = ProductFactory(title=u'desktop')
    prod_mobile = ProductFactory(title=u'mobile')
    data = new_document_data()
    data.update({'products': [prod_desktop.id, prod_mobile.id], 'title': d.title, 'slug': d.slug, 'form': 'doc'})
    self.client.post(reverse('wiki.edit_document', args=[d.slug]), data)
    eq_(sorted(Document.objects.get(id=d.id).products.values_list('id', flat=True)), sorted([prod.id for prod in [prod_desktop, prod_mobile]]))
    data.update({'products': [prod_desktop.id], 'form': 'doc'})
    self.client.post(reverse('wiki.edit_document', args=[data['slug']]), data)
    eq_(sorted(Document.objects.get(id=d.id).products.values_list('id', flat=True)), sorted([prod.id for prod in [prod_desktop]]))
