'Make sure when something besides \'pk\' is used for detail_uri_name and
it isn\'t unique that we still look up the correct object and don\'t
create a duplicate.'

def test_put_detail_with_non_unique_detail_uri_name(self):

    self.assertFalse(Note._meta.get_field(u'slug').unique)
    new_note = Note.objects.get(slug=u'another-post')
    new_note.author = User.objects.get(username=u'johndoe')
    new_note.save()
    self.assertEqual(Note.objects.count(), 6)
    request = MockRequest()
    request.GET = {u'format': u'json'}
    request.method = u'PUT'
    request.set_body(u'{"content":    "The    cat    is    back.    The    dog    coughed    him    up    out    back.",    "created":    "2010-04-03    20:05:00",    "is_active":    true,    "title":    "The    Cat    Is    Back",    "updated":    "2010-04-03    20:05:00"}')
    resource = NoteResourceNonUniqueDetailUriName()
    resp = resource.put_detail(request, slug=new_note.slug)
    self.assertEqual(resp.status_code, 200)
    self.assertEqual(Note.objects.count(), 6)
    data = json.loads(resp.content.decode(u'utf-8'))
    self.assertEqual(data[u'id'], new_note.pk)
    self.assertEqual(data[u'slug'], new_note.slug)
    self.assertTrue((u'author' in data))
    self.assertFalse((u'constant' in data))
    self.assertTrue((u'resource_uri' in data))
    self.assertTrue((u'title' in data))
    self.assertTrue((u'is_active' in data))
