Exemple #1
0
    def test_get_RandomMsgs_err(self):

        try:
            constants.SELECT_ALL_TABLES_SQL = 'no_exists_file'
            dbUtil.getRandomMsgs(self.conn)
        finally:
            constants.SELECT_ALL_TABLES_SQL = "sql/select_all_tables.sql"
Exemple #2
0
    def test_getRandomMsgs_not_exist_msg(self):

        expected = []

        constants.SELECT_ALL_TABLES_SQL = 'sql/select_all_tables_one_table.sql'
        actual = dbUtil.getRandomMsgs(self.conn)

        eq_(actual, expected)

        constants.SELECT_ALL_TABLES_SQL = 'sql/select_all_tables.sql'
Exemple #3
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'