def test_get_with_nonexistent_backend_should_raise(self): configure( pools={ BackendPool.backend_type: ( u'{module}.{cls}'.format(module=__name__, cls=FakeXYZBackend.__name__), u'{module}.{cls}'.format(module=__name__, cls=FakeABCBackend.__name__), ) }) with pytest.raises(InvalidBackendError): BackendPool.get('fake_fake')
def test_get_with_nonexistent_backend_should_raise(self): configure(pools={ BackendPool.backend_type: ( u'{module}.{cls}'.format( module=__name__, cls=FakeXYZBackend.__name__ ), u'{module}.{cls}'.format( module=__name__, cls=FakeABCBackend.__name__ ), ) }) with pytest.raises(InvalidBackendError): BackendPool.get('fake_fake')
def test_get_with_inexisting_backend_should_raise(self): settings.POOL_OF_RAMOS = { BackendPool.backend_type: ( u'{module}.{cls}'.format( module=__name__, cls=FakeXYZBackend.__name__ ), u'{module}.{cls}'.format( module=__name__, cls=FakeABCBackend.__name__ ), ) } with pytest.raises(InvalidBackendError): BackendPool.get('fake_fake')
def test_get_should_pass_args_to_the_backend_constructor( self, configured_pool_with_fake_backend_with_constructor ): backend = BackendPool.get( 'fake_with_args', 'arg1', 'arg2', arg3=3, arg4=4 ) assert backend.args == ('arg1', 'arg2') assert backend.kwargs == {'arg3': 3, 'arg4': 4}
def test_get_should_return_the_backend_instance(self): configure( pools={ BackendPool.backend_type: ( u'{module}.{cls}'.format(module=__name__, cls=FakeXYZBackend.__name__), u'{module}.{cls}'.format(module=__name__, cls=FakeABCBackend.__name__), ) }) backend = BackendPool.get('fake_abc') assert isinstance(backend, FakeABCBackend)
def test_get_should_pass_args_to_the_backend_constructor(self): configure( pools={ BackendPool.backend_type: (u'{module}.{cls}'.format( module=__name__, cls=FakeBackendWithConstructor.__name__), ) }) backend = BackendPool.get('fake_with_args', 'arg1', 'arg2', arg3=3, arg4=4) assert backend.args == ('arg1', 'arg2') assert backend.kwargs == {'arg3': 3, 'arg4': 4}
def test_get_should_return_the_backend_instance(self): configure(pools={ BackendPool.backend_type: ( u'{module}.{cls}'.format( module=__name__, cls=FakeXYZBackend.__name__ ), u'{module}.{cls}'.format( module=__name__, cls=FakeABCBackend.__name__ ), ) }) backend = BackendPool.get('fake_abc') assert isinstance(backend, FakeABCBackend)
def test_get_should_return_the_backend_instance(self): settings.POOL_OF_RAMOS = { BackendPool.backend_type: ( u'{module}.{cls}'.format( module=__name__, cls=FakeXYZBackend.__name__ ), u'{module}.{cls}'.format( module=__name__, cls=FakeABCBackend.__name__ ), ) } backend = BackendPool.get('fake_abc') assert isinstance(backend, FakeABCBackend)
def test_get_with_nonexistent_backend_should_raise(self, configured_pools): with pytest.raises(InvalidBackendError): BackendPool.get('fake_fake')
def test_get_should_return_the_backend_instance(self, configured_pools): backend = BackendPool.get('fake_abc') assert isinstance(backend, FakeABCBackend)