Example #1
0
 def test_db_connect_successful(self):
     connection = SQLStore.get_connection()
     self.assertIsNotNone(connection)
     connection.close()
     wait_time = 0
     SQLStore.set_up(wait_time)
Example #2
0
 def test_db_connect_not_successful(self, mock_connection):
     wait_time = 0
     mock_connection.return_value = None
     with self.assertRaises(Exception):
         SQLStore.set_up(wait_time)
Example #3
0
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.

# GENERICS
from adapters.store import SQLStore
from unittest.mock import patch
# TESTS
from unittest import skipIf
import unittest
import os

# TODO: move to test_store_backends module

if os.getenv('MYSQL_TESTS', 'NO') == 'YES':
    SQLStore.set_up()


@skipIf(
    os.getenv('MYSQL_TESTS', 'NO') != 'YES',
    "MYSQL_TESTS not set in environment variables")
class TestCaseManifestManifest(unittest.TestCase):
    def test_db_connect_successful(self):
        connection = SQLStore.get_connection()
        self.assertIsNotNone(connection)
        connection.close()
        wait_time = 0
        SQLStore.set_up(wait_time)

    @patch.object(SQLStore, 'get_connection')
    def test_db_connect_not_successful(self, mock_connection):