'Test that a user cannot add a duplicate key'

def _check_duplicate_key(self, pubkey, pubkey2):

    url = u'/v1/keys'
    body = {u'id': u'mykey@box.local', u'public': pubkey}
    response = self.client.post(url, json.dumps(body), content_type=u'application/json', HTTP_AUTHORIZATION=u'token    {}'.format(self.token))
    self.assertEqual(response.status_code, 201)
    response = self.client.post(url, json.dumps(body), content_type=u'application/json', HTTP_AUTHORIZATION=u'token    {}'.format(self.token))
    self.assertEqual(response.status_code, 400)
    body = {u'id': u'mykey2@box.local', u'public': pubkey}
    response = self.client.post(url, json.dumps(body), content_type=u'application/json', HTTP_AUTHORIZATION=u'token    {}'.format(self.token))
    self.assertEqual(response.status_code, 400)
    body = {u'id': u'mykey2@box.local', u'public': pubkey2}
    response = self.client.post(url, json.dumps(body), content_type=u'application/json', HTTP_AUTHORIZATION=u'token    {}'.format(self.token))
    self.assertEqual(response.status_code, 201)
