Esempio n. 1
0
    def test_get_unittest_with_dbconfig(self, mock_openfile, mocked_sa_url):
        self.options_db.unittest_db_url = 'sqlite:///fake/database'
        self.options_db.unittest_db_config = '/fake/path/to/db/'

        mocked_open = mock.Mock(spec=file)
        mocked_open.__enter__ = mock.Mock()
        mocked_open.__exit__ = mock.Mock()
        mock_openfile.return_value = mocked_open

        testify.assert_not_equal(find_db_url(self.options_db),
                                 self.options_db.unittest_db_url)
        mocked_open.read.assert_called
        mocked_sa_url.URL.assert_called
Esempio n. 2
0
    def test_get_unittest_with_dbconfig(self, mock_openfile, mocked_sa_url):
        self.options_db.unittest_db_url = 'sqlite:///fake/database'
        self.options_db.unittest_db_config = '/fake/path/to/db/'

        mocked_open = mock.Mock(spec=file)
        mocked_open.__enter__ = mock.Mock()
        mocked_open.__exit__ = mock.Mock()
        mock_openfile.return_value = mocked_open

        testify.assert_not_equal(find_db_url(self.options_db),
                                 self.options_db.unittest_db_url)
        mocked_open.read.assert_called
        mocked_sa_url.URL.assert_called
Esempio n. 3
0
    def test_find_violation_url(self):
        # Check for violation_db_url
        db_url = 'sqlite:///test2.db'
        self.options_db.violation_dburl = db_url

        self.assertEqual(db_url, find_db_url(self.options_db))
Esempio n. 4
0
    def test_find_db_url(self):
        # Check for unittest_db_url
        db_url = 'test/test'
        self.options_db.unittest_db_url = db_url

        self.assertEqual(db_url, find_db_url(self.options_db))
Esempio n. 5
0
    def test_find_violation_url(self):
        # Check for violation_db_url
        db_url = 'sqlite:///test2.db'
        self.options_db.violation_dburl = db_url

        self.assertEqual(db_url, find_db_url(self.options_db))
Esempio n. 6
0
    def test_find_db_url(self):
        # Check for unittest_db_url
        db_url = 'test/test'
        self.options_db.unittest_db_url = db_url

        self.assertEqual(db_url, find_db_url(self.options_db))