'Change tags on Document by creating Revisions'

def test_revision_tags(self):

    rev = revision(is_approved=True, save=True, content='Sample    document')
    eq_(0, Document.objects.filter(tags__name='foo').count())
    eq_(0, Document.objects.filter(tags__name='alpha').count())
    r = revision(document=rev.document, content='Update    to    document', is_approved=True, tags='foo,    bar,    baz')
    r.save()
    eq_(1, Document.objects.filter(tags__name='foo').count())
    eq_(0, Document.objects.filter(tags__name='alpha').count())
    r = revision(document=rev.document, content='Another    update', is_approved=True, tags='alpha,    beta,    gamma')
    r.save()
    eq_(0, Document.objects.filter(tags__name='foo').count())
    eq_(1, Document.objects.filter(tags__name='alpha').count())
