Upgrade database definition
diff --git a/gstack/configure.py b/gstack/configure.py
index f528122..2bcf4bb 100644
--- a/gstack/configure.py
+++ b/gstack/configure.py
@@ -28,7 +28,7 @@
def main():
config_folder = _create_config_folder()
_create_config_file(config_folder)
- _create_database()
+ _upgrade_database()
def _create_config_folder():
@@ -113,7 +113,7 @@
return attribute
-def _create_database():
+def _upgrade_database():
directory = os.path.join(os.path.dirname(__file__), '../migrations')
database_config = AlembicConfig(os.path.join(
directory,
diff --git a/gstack/oauth2provider.py b/gstack/oauth2provider.py
index 0c4a980..8eb166f 100644
--- a/gstack/oauth2provider.py
+++ b/gstack/oauth2provider.py
@@ -148,6 +148,7 @@
return request.headers.get('Authorization')
def validate_access_token(self, access_token, authorization):
+ print 'pp'
found_access_token = AccessToken.query.get(access_token)
if found_access_token is not None and found_access_token.data != 'false':
access_token_data = json.loads(found_access_token.data)
diff --git a/migrations/versions/25c3e5241cd0_.py b/migrations/versions/25c3e5241cd0_.py
new file mode 100644
index 0000000..b330147
--- /dev/null
+++ b/migrations/versions/25c3e5241cd0_.py
@@ -0,0 +1,35 @@
+"""empty message
+
+Revision ID: 25c3e5241cd0
+Revises: 76bb287a37d
+Create Date: 2014-07-27 16:19:12.634404
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '25c3e5241cd0'
+down_revision = '76bb287a37d'
+
+from alembic import op
+import sqlalchemy as sa
+
+
+def upgrade():
+ op.add_column('accesstoken',
+ sa.Column(
+ 'id_token',
+ sa.String(length=1000),
+ nullable=True
+ )
+ )
+
+ op.add_column('refreshtoken',
+ sa.Column(
+ 'id_token',
+ sa.String(length=1000),
+ nullable=True
+ )
+ )
+
+def downgrade():
+ pass
diff --git a/migrations/versions/76bb287a37d_.py b/migrations/versions/76bb287a37d_.py
index 4353642..efc9887 100644
--- a/migrations/versions/76bb287a37d_.py
+++ b/migrations/versions/76bb287a37d_.py
@@ -16,7 +16,10 @@
def upgrade():
op.create_table('accesstoken',
- sa.Column('access_token', sa.String(length=255), nullable=False),
+ sa.Column(
+ 'access_token',
+ sa.String(length=255),
+ nullable=False),
sa.Column(
'client_id',
sa.String(length=255),
@@ -26,10 +29,6 @@
sa.String(length=10),
nullable=True),
sa.Column(
- 'id_token',
- sa.String(length=1000),
- nullable=True),
- sa.Column(
'data',
sa.String(length=500),
nullable=True),
@@ -37,7 +36,9 @@
sa.UniqueConstraint('client_id')
)
op.create_table('client',
- sa.Column('client_id', sa.String(length=255), nullable=False),
+ sa.Column('client_id',
+ sa.String(length=255),
+ nullable=False),
sa.Column(
'client_secret',
sa.String(length=255),
@@ -46,16 +47,15 @@
sa.UniqueConstraint('client_secret')
)
op.create_table('refreshtoken',
- sa.Column('refresh_token', sa.String(length=255), nullable=False),
+ sa.Column(
+ 'refresh_token',
+ sa.String(length=255),
+ nullable=False),
sa.Column(
'client_id',
sa.String(length=255),
nullable=True),
sa.Column(
- 'id_token',
- sa.String(length=1000),
- nullable=True),
- sa.Column(
'data',
sa.String(length=500),
nullable=True),
@@ -65,4 +65,4 @@
def downgrade():
- pass
+ pass
\ No newline at end of file
diff --git a/pylint.rc b/pylint.rc
index 6173b69..baada8d 100644
--- a/pylint.rc
+++ b/pylint.rc
@@ -214,7 +214,7 @@
[DESIGN]
# Maximum number of arguments for function / method
-max-args=8
+max-args=10
# Argument names that match this expression will be ignored. Default to name
# with leading underscore
diff --git a/pyoauth2/tests/test_integration.py b/pyoauth2/tests/test_integration.py
index 8b7350e..e164304 100644
--- a/pyoauth2/tests/test_integration.py
+++ b/pyoauth2/tests/test_integration.py
@@ -57,7 +57,7 @@
def persist_token_information(self, client_id, scope, access_token,
token_type, expires_in, refresh_token,
- data):
+ id_token, data):
pass
def discard_authorization_code(self, client_id, code):
@@ -105,6 +105,5 @@
scope='example')
self.assertEquals(40, len(data['access_token']))
- self.assertEquals(40, len(data['refresh_token']))
self.assertEquals('Bearer', data['token_type'])
- self.assertEquals(3600, data['expires_in'])
+ self.assertEquals('3600', data['expires_in'])