          mixin.CONTENT = cleaned_data
  
          response = mixin.post(request)
          self.assertEquals(2, CustomUser.objects.count())
          self.assertEquals(1, response.cleaned_content.groups.count())
          self.assertEquals('foo1', response.cleaned_content.groups.all()[0].name)
  
          group2 = Group(name='foo2')
          group2.save()
  
          form_data = {'username': 'bar2', 'groups': [group.id, group2.id]}
 
</s> remove         self.assertEquals(0, response.cleaned_content.groups.count())
 </s> add         self.assertEquals(0, response.raw_content.groups.count()) </s> remove         self.assertEquals(2, response.cleaned_content.groups.count())
        self.assertEquals('foo1', response.cleaned_content.groups.all()[0].name)
        self.assertEquals('foo2', response.cleaned_content.groups.all()[1].name)
 </s> add         self.assertEquals(2, response.raw_content.groups.count())
        self.assertEquals('foo1', response.raw_content.groups.all()[0].name)
        self.assertEquals('foo2', response.raw_content.groups.all()[1].name) </s> remove         self.assertEquals(1, response.cleaned_content.groups.count())
        self.assertEquals('foo', response.cleaned_content.groups.all()[0].name)
 </s> add         self.assertEquals(1, response.raw_content.groups.count())
        self.assertEquals('foo', response.raw_content.groups.all()[0].name) </s> remove         self.assertEquals('foo', response.cleaned_content.name)
 </s> add         self.assertEquals('foo', response.raw_content.name) </s> remove         content = json.loads(response.content)
 </s> add         content = response.raw_content
        self.assertEquals(1, response.raw_content.groups.count())
        self.assertEquals('foo1', response.raw_content.groups.all()[0].name)
          mixin.CONTENT = cleaned_data
  
          response = mixin.post(request)
          self.assertEquals(2, CustomUser.objects.count())
        self.assertEquals(1, response.raw_content.groups.count())
        self.assertEquals('foo1', response.raw_content.groups.all()[0].name)
        self.assertEquals(1, response.raw_content.groups.count())
        self.assertEquals('foo1', response.raw_content.groups.all()[0].name)
  
          group2 = Group(name='foo2')
          group2.save()
  
          form_data = {'username': 'bar2', 'groups': [group.id, group2.id]}
keep keep keep keep replace replace keep keep keep keep keep
 Response as a subclass of HttpResponse - first draft, not quite there yet. 
djangorestframework/tests/mixins.py