Esempio n. 1
0
class Database():
    def __init__(self):
        self.impl = PostgresDatabase("dbname='stockcat' user='******' host='localhost' password='******'")

    def store(self, feed):
        return self.impl.store(feed)

    def get_stock_symbol_list(self):
        return self.impl.get_stock_symbol_list()

    def get_capital_increase_by_cash(self, stock_symbol):
        return self.impl.get_capital_increase_by_cash(stock_symbol)

    def get_capital_increase_by_earnings(self, stock_symbol):
        return self.impl.get_capital_increase_by_earnings(stock_symbol)

    def get_capital_increase_by_surplus(self, stock_symbol):
        return self.impl.get_capital_increase_by_surplus(stock_symbol)
class PostgresDatabaseTest(unittest.TestCase):
    def setUp(self):
        self.database = PostgresDatabase("dbname='stockcat' user='******' host='localhost' password='******'")

    def tearDown(self):
        self.database = None
    
    def test_get_stock_symbol_list(self):
        stock_symbol_list = self.database.get_stock_symbol_list()
        self.assertEqual(stock_symbol_list[0], ('1101', datetime.date(1962, 2, 9)))
        self.assertEqual(stock_symbol_list[1], ('1102', datetime.date(1962, 6, 8)))
Esempio n. 3
0
 def __init__(self):
     self.impl = PostgresDatabase("dbname='stockcat' user='******' host='localhost' password='******'")
 def setUp(self):
     self.database = PostgresDatabase("dbname='stockcat' user='******' host='localhost' password='******'")