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(get_db_url(self.options_db),
                                 self.options_db.unittest_db_url)
        mocked_open.read.assert_called
        mocked_sa_url.URL.assert_called
Exemple #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()
        mocked_open.__enter__ = mock.Mock()
        mocked_open.__exit__ = mock.Mock()
        mock_openfile.return_value = mocked_open

        testify.assert_not_equal(get_db_url(self.options_db),
                                 self.options_db.unittest_db_url)
        mocked_open.read.assert_called
        mocked_sa_url.URL.assert_called
 def test_get_db_url(self):
     db_url = 'test/test'
     self.options_db.violation_dburl = db_url
     self.assertEqual(db_url, get_db_url(self.options_db))
Exemple #4
0
 def test_get_db_url(self):
     db_url = 'test/test'
     self.options_db.violation_dburl = db_url
     self.assertEqual(db_url, get_db_url(self.options_db))