Skip to content
Snippets Groups Projects
Commit b692b11f authored by Kevin Morris's avatar Kevin Morris
Browse files

add Group SQLAlchemy ORM model


Signed-off-by: Kevin Morris's avatarKevin Morris <kevr@0cost.org>
parent e1ab02c2
No related branches found
No related tags found
No related merge requests found
from sqlalchemy.orm import mapper
from aurweb.schema import Groups
class Group:
def __init__(self, Name: str = None):
self.Name = Name
mapper(Group, Groups)
import pytest
from sqlalchemy.exc import IntegrityError
from aurweb.db import create, delete, get_engine
from aurweb.models.group import Group
def test_group_creation():
get_engine()
group = create(Group, Name="Test Group")
assert bool(group.ID)
assert group.Name == "Test Group"
delete(Group, Group.ID == group.ID)
def test_group_null_name_raises_exception():
from aurweb.db import session
with pytest.raises(IntegrityError):
create(Group)
session.rollback()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment