Blame view

tests/backend_tests.py 735 Bytes
506d2f02   hitier   Initialize unit t...
1
2
import unittest
from pdc_config import TestConfig
1aeda847   hitier   Two db request wr...
3
from app import create_app, db_mgr
506d2f02   hitier   Initialize unit t...
4
5
6
7
8


class BaseTestCase(unittest.TestCase):
    def setUp(self):
        # configure data base
506d2f02   hitier   Initialize unit t...
9
10
11
12
13
14
15
16
17
        self.app = create_app(TestConfig)
        self.app_context = self.app.app_context()
        self.app_context.push()

    def tearDown(self):
        self.app_context.pop()

    def test_always_true(self):
        self.assertTrue(True)
1aeda847   hitier   Two db request wr...
18
19
20
21
22
23
24
25
26
27
28
29


class DbMgrTestCase(BaseTestCase):

    def test_agents(self):
        all_agents = db_mgr.agents()
        print(len(all_agents))
        self.assertEqual(548, len(all_agents))

    def test_charges_by_agent(self):
        all_charges = db_mgr.charges_by_agent(355)
        self.assertEqual(6, len(all_charges))