Skip to content

Commit

Permalink
Fixed a few issues with database models and added a small test
Browse files Browse the repository at this point in the history
  • Loading branch information
TaaviE committed Jul 21, 2019
1 parent 1471769 commit aba80fb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion models/subscription_types_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class SubscriptionType(db.Model):
"""
__tablename__ = "subscription_types"

id = db.Column(db.Integer(255), db.Sequence("subscription_types_id_seq", start=1, increment=1),
id = db.Column(db.Integer(), db.Sequence("subscription_types_id_seq", start=1, increment=1),
server_default=FetchedValue(), primary_key=True, nullable=False, autoincrement=True)
name = db.Column(db.VARCHAR(255), nullable=False)

Expand Down
2 changes: 1 addition & 1 deletion models/users_model.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from datetime import datetime

from flask_dance.consumer.backend.sqla import OAuthConsumerMixin
from flask_dance.consumer.storage.sqla import OAuthConsumerMixin
from flask_security import UserMixin, RoleMixin
from sqlalchemy import Column, Integer, String, ForeignKey, DateTime, Boolean, FetchedValue
from sqlalchemy.orm import backref, relationship
Expand Down
8 changes: 6 additions & 2 deletions tests/utilitytest.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
from unittest import TestCase, main

from utility import get_name_in_genitive
from utility_standalone import decrypt_id, encrypt_id


class UtilityEncryptionTest(TestCase):

class UtilityTest(TestCase):
def test_split(self):
for inputnumber in range(-1000, 1000):
result = decrypt_id(encrypt_id(inputnumber))
self.assertEqual(int(result), inputnumber)

def test_name_lookup(self):
assert (get_name_in_genitive("Triin") == "Triinu")



if __name__ == '__main__':
main()

0 comments on commit aba80fb

Please sign in to comment.