feat: add table/model for app upgrades
This commit is contained in:
parent
e855a84c37
commit
110ff69d6d
14 changed files with 275 additions and 2 deletions
15
tests/db/model/test_upgrades.py
Normal file
15
tests/db/model/test_upgrades.py
Normal file
|
@ -0,0 +1,15 @@
|
|||
# -*- coding: utf-8; -*-
|
||||
|
||||
from unittest import TestCase
|
||||
|
||||
try:
|
||||
from wuttjamaican.db.model import upgrades as mod
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
|
||||
class TestUpgrade(TestCase):
|
||||
|
||||
def test_str(self):
|
||||
upgrade = mod.Upgrade(description="upgrade foo")
|
||||
self.assertEqual(str(upgrade), "upgrade foo")
|
|
@ -10,6 +10,7 @@ from unittest.mock import patch, MagicMock
|
|||
|
||||
import pytest
|
||||
|
||||
import wuttjamaican.enum
|
||||
from wuttjamaican import app
|
||||
from wuttjamaican.conf import WuttaConfig
|
||||
from wuttjamaican.util import UNSPECIFIED
|
||||
|
@ -27,6 +28,9 @@ class TestAppHandler(TestCase):
|
|||
self.assertEqual(self.app.handlers, {})
|
||||
self.assertEqual(self.app.appname, 'wuttatest')
|
||||
|
||||
def test_get_enum(self):
|
||||
self.assertIs(self.app.get_enum(), wuttjamaican.enum)
|
||||
|
||||
def test_load_object(self):
|
||||
|
||||
# just confirm the method works on a basic level; the
|
||||
|
@ -403,6 +407,12 @@ class TestAppProvider(TestCase):
|
|||
|
||||
def test_getattr(self):
|
||||
|
||||
# enum
|
||||
self.assertNotIn('enum', self.app.__dict__)
|
||||
self.assertIs(self.app.enum, wuttjamaican.enum)
|
||||
|
||||
# now we test that providers are loaded...
|
||||
|
||||
class FakeProvider(app.AppProvider):
|
||||
def fake_foo(self):
|
||||
return 42
|
||||
|
@ -417,6 +427,16 @@ class TestAppProvider(TestCase):
|
|||
self.assertIs(self.app.providers, fake_providers)
|
||||
get_all_providers.assert_called_once_with()
|
||||
|
||||
def test_getattr_model(self):
|
||||
try:
|
||||
import wuttjamaican.db.model
|
||||
except ImportError:
|
||||
pytest.skip("test not relevant without sqlalchemy")
|
||||
|
||||
# model
|
||||
self.assertNotIn('model', self.app.__dict__)
|
||||
self.assertIs(self.app.model, wuttjamaican.db.model)
|
||||
|
||||
def test_getattr_providers(self):
|
||||
|
||||
# collection of providers is loaded on demand
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue