def test_get_requirement_params(self): """ This @statmicmethod should return a dictionary. The function should work both with and without and application context. It retreives the relevant parameters from postgres, for consul. """ consul_mock = Mock(running_port=8500) postgres_mock = Mock(running_host='localhost', running_port=5437) redis_mock = Mock(running_host='localhost', running_port=6739) P = ConsulProvisioner(container=consul_mock, services=['adsws'], requirements={ 'postgres': postgres_mock, 'redis': redis_mock }) db_params = P.get_db_params() self.assertEqual(db_params['HOST'], '172.17.42.1') self.assertEqual(db_params['PORT'], 5437) cache_params = P.get_cache_params() self.assertEqual(cache_params['HOST'], '172.17.42.1') self.assertEqual(cache_params['PORT'], 6739)
def test_get_requirement_params(self): """ This @statmicmethod should return a dictionary. The function should work both with and without and application context. It retreives the relevant parameters from postgres, for consul. """ consul_mock = Mock(running_port=8500) postgres_mock = Mock(running_host='localhost', running_port=5437) redis_mock = Mock(running_host='localhost', running_port=6739) P = ConsulProvisioner(container=consul_mock, services=['adsws'], requirements={'postgres': postgres_mock, 'redis': redis_mock} ) db_params = P.get_db_params() self.assertEqual(db_params['HOST'], '172.17.42.1') self.assertEqual(db_params['PORT'], 5437) cache_params = P.get_cache_params() self.assertEqual(cache_params['HOST'], '172.17.42.1') self.assertEqual(cache_params['PORT'], 6739)