Skip to content

Commit

Permalink
tests: fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ntarocco committed Aug 7, 2023
1 parent 5125ba0 commit 484d992
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import os
import tempfile
import uuid
from json import JSONEncoder as BaseEncoder

import pytest
Expand Down Expand Up @@ -161,11 +162,11 @@ def sqlalchemy_datastore(request, app, tmpdir):
roles_users = db.Table(
"roles_users",
db.Column("user_id", db.Integer(), db.ForeignKey("user.id")),
db.Column("role_id", db.Integer(), db.ForeignKey("role.id")),
db.Column("role_id", db.String(80), db.ForeignKey("role.id")),
)

class Role(db.Model, RoleMixin):
id = db.Column(db.Integer(), primary_key=True)
id = db.Column(db.String(80), primary_key=True, default=lambda x: str(uuid.uuid4()))
name = db.Column(db.String(80), unique=True)
description = db.Column(db.String(255))

Expand Down Expand Up @@ -219,11 +220,11 @@ class RolesUsers(Base):
__tablename__ = "roles_users"
id = Column(Integer(), primary_key=True)
user_id = Column("user_id", Integer(), ForeignKey("user.id"))
role_id = Column("role_id", Integer(), ForeignKey("role.id"))
role_id = Column("role_id", String(80), ForeignKey("role.id"))

class Role(Base, RoleMixin):
__tablename__ = "role"
id = Column(Integer(), primary_key=True)
id = Column(String(80), primary_key=True, default=lambda x: str(uuid.uuid4()))
name = Column(String(80), unique=True)
description = Column(String(255))

Expand Down
2 changes: 1 addition & 1 deletion tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def logout(client, endpoint=None, **kwargs):

def create_roles(ds):
for role in ('admin', 'editor', 'author'):
ds.create_role(name=role)
ds.create_role(id=role, name=role)
ds.commit()


Expand Down

0 comments on commit 484d992

Please sign in to comment.