Ejemplo n.º 1
0
    def test_insert_message(self):
        expected = ([1], ['test_message'])

        dbUtil.insert_message(self.conn, 'test_table', 'test_message')

        actual = dbUtil.getAllMsgs(self.conn, 'test_table')
        eq_(actual, expected)
Ejemplo n.º 2
0
    def test_search_msg_by_kword(self):

        expected = (1, 'test_message', 'test_table',)
        dbUtil.insert_message(self.conn, 'test_table', 'test_message')

        actual = dbUtil.search_msg_by_kword(self.conn, 'test_message')

        eq_((actual[0].nos[0], actual[0].msgs[0], actual[0].table_name), expected)
Ejemplo n.º 3
0
    def test_get_single_msg(self):

        expected = 'test_message'
        dbUtil.insert_message(self.conn, 'test_table', 'test_message')

        actual = dbUtil.get_single_msg(self.conn, 'test_table', 1)

        eq_(actual, expected)
Ejemplo n.º 4
0
    def test_getAllMsgs(self):

        expected = ([1], ['test_message'])
        dbUtil.insert_message(self.conn, 'test_table', 'test_message')
        (no_list, msg_list) = dbUtil.getAllMsgs(self.conn, 'test_table')

        actual = (no_list, msg_list)
        eq_(actual, expected)
Ejemplo n.º 5
0
    def test_insert_message_rollback02(self):
        expected = ()

        dbUtil.insert_message(self.conn, 'test_table', 'test_message')

        dbUtil.insert_message(self.conn, 'not_exist_table', 'rollback_message')
        self.conn.rollback()

        actual = dbUtil.getAllMsgs(self.conn, 'test_table')

        eq_(actual, expected)
Ejemplo n.º 6
0
    def test_getRandomMsgs(self):

        expected = ('test_table', 1, 'test_message')
        dbUtil.insert_message(self.conn, 'test_table', 'test_message')

        constants.SELECT_ALL_TABLES_SQL = 'sql/select_all_tables_one_table.sql'
        (table_name, nos, msgs) = dbUtil.getRandomMsgs(self.conn)

        actual = (table_name, nos[0], msgs[0])
        eq_(actual, expected)

        constants.SELECT_ALL_TABLES_SQL = 'sql/select_all_tables.sql'
Ejemplo n.º 7
0
 def test_delete_message(self):
     expected = True
     dbUtil.insert_message(self.conn, 'test_table', 'test_message')
     actual = dbUtil.delete_message(self.conn, 'test_table', 1)
     eq_(actual, expected)