change oauth.consumer description into nullable
Change-Id: I158e916f1f422882b83f648d7720f8f87a4c5813 Fixes: Bug #1215482
This commit is contained in:
parent
4dbda648c9
commit
42b107e484
@ -29,7 +29,7 @@ class Consumer(sql.ModelBase, sql.DictBase):
|
||||
__tablename__ = 'consumer'
|
||||
attributes = ['id', 'description', 'secret']
|
||||
id = sql.Column(sql.String(64), primary_key=True, nullable=False)
|
||||
description = sql.Column(sql.String(64), nullable=False)
|
||||
description = sql.Column(sql.String(64), nullable=True)
|
||||
secret = sql.Column(sql.String(64), nullable=False)
|
||||
extra = sql.Column(sql.JsonBlob(), nullable=False)
|
||||
|
||||
|
@ -0,0 +1,31 @@
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||
|
||||
# Copyright 2013 OpenStack Foundation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import sqlalchemy as sql
|
||||
|
||||
|
||||
def upgrade(migrate_engine):
|
||||
meta = sql.MetaData()
|
||||
meta.bind = migrate_engine
|
||||
user_table = sql.Table('consumer', meta, autoload=True)
|
||||
user_table.c.description.alter(nullable=True)
|
||||
|
||||
|
||||
def downgrade(migrate_engine):
|
||||
meta = sql.MetaData()
|
||||
meta.bind = migrate_engine
|
||||
user_table = sql.Table('consumer', meta, autoload=True)
|
||||
user_table.c.description.alter(nullable=False)
|
@ -121,18 +121,30 @@ class OAuth1Tests(test_v3.RestfulTestCase):
|
||||
|
||||
class ConsumerCRUDTests(OAuth1Tests):
|
||||
|
||||
def test_consumer_create(self):
|
||||
description = uuid.uuid4().hex
|
||||
ref = {'description': description}
|
||||
def _consumer_create(self, description=None, description_flag=True):
|
||||
if description_flag:
|
||||
ref = {'description': description}
|
||||
else:
|
||||
ref = {}
|
||||
resp = self.post(
|
||||
'/OS-OAUTH1/consumers',
|
||||
body={'consumer': ref})
|
||||
consumer = resp.result.get('consumer')
|
||||
consumer_id = consumer.get('id')
|
||||
self.assertEqual(consumer.get('description'), description)
|
||||
self.assertEqual(consumer['description'], description)
|
||||
self.assertIsNotNone(consumer_id)
|
||||
self.assertIsNotNone(consumer.get('secret'))
|
||||
|
||||
def test_consumer_create(self):
|
||||
description = uuid.uuid4().hex
|
||||
self._consumer_create(description=description)
|
||||
|
||||
def test_consumer_create_none_desc_1(self):
|
||||
self._consumer_create()
|
||||
|
||||
def test_consumer_create_none_desc_2(self):
|
||||
self._consumer_create(description_flag=False)
|
||||
|
||||
def test_consumer_delete(self):
|
||||
consumer = self._create_single_consumer()
|
||||
consumer_id = consumer.get('id')
|
||||
|
Loading…
Reference in New Issue
Block a user