'Test that invalid config keys are rejected.'

@mock.patch(u'requests.post', mock_status_ok)
def test_invalid_config_keys(self):

    keys = (u'123', u'../../foo', u'FOO/', u'FOO-BAR')
    url = u'/v1/apps'
    response = self.client.post(url, HTTP_AUTHORIZATION=u'token    {}'.format(self.token))
    self.assertEqual(response.status_code, 201)
    app_id = response.data[u'id']
    url = u'/v1/apps/{app_id}/config'.format(**locals())
    for k in keys:
        body = {u'values': json.dumps({k: u'testvalue'})}
        resp = self.client.post(url, json.dumps(body), content_type=u'application/json', HTTP_AUTHORIZATION=u'token    {}'.format(self.token))
        self.assertEqual(resp.status_code, 400)
