Commit 8e7f1a03 authored by Kevin Morris's avatar Kevin Morris
Browse files

add aurweb.models.account_type.AccountType

Signed-off-by: Kevin Morris's avatarKevin Morris <>
parent 77ab3f7f
from sqlalchemy.orm import mapper
from aurweb.schema import AccountTypes
class AccountType:
""" An ORM model of a single AccountTypes record. """
def __init__(self, **kwargs):
self.AccountType = kwargs.pop("AccountType")
def __str__(self):
return str(self.AccountType)
def __repr__(self):
return "<AccountType(ID='%s', AccountType='%s')>" % (
self.ID, str(self))
mapper(AccountType, AccountTypes, confirm_deleted_rows=False)
import pytest
from aurweb.models.account_type import AccountType
from aurweb.testing import setup_test_db
def setup():
def test_account_type():
""" Test creating an AccountType, and reading its columns. """
from aurweb.db import session
account_type = AccountType(AccountType="TestUser")
# Make sure it got created and was given an ID.
assert bool(account_type.ID)
# Next, test our string functions.
assert str(account_type) == "TestUser"
assert repr(account_type) == \
"<AccountType(ID='%s', AccountType='TestUser')>" % (
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment