'A PUT request with an if-match header throws a 412 Precondition
Failed if the underlying document has been changed.'

def test_put_etag_conflict(self):

    resp = self.client.get(self.url)
    orig_etag = resp['ETag']
    content1 = '\n                                                <h2    id="s1">Section    1</h2>\n                                                <p>New    section    1</p>\n                                                <h2    id="s2">Section    2</h2>\n                                                <p>New    section    2</p>\n                                '
    resp = self._put(self.url, dict(content=content1), HTTP_IF_MATCH=orig_etag, HTTP_AUTHORIZATION=self.basic_auth)
    eq_(205, resp.status_code)
    resp = self.client.get(self.url)
    new_etag = resp['ETag']
    ok_((orig_etag != new_etag))
    resp = self._put(self.url, dict(content=content1), HTTP_IF_MATCH=orig_etag, HTTP_AUTHORIZATION=self.basic_auth)
    eq_(412, resp.status_code)
    resp = self._put(self.url, dict(content=content1), HTTP_IF_MATCH=new_etag, HTTP_AUTHORIZATION=self.basic_auth)
    eq_(205, resp.status_code)
