Esempio n. 1
0
def test_deployment_controller_publish_app():

    redis = yield txredisapi.Connection(dbid=2)
    yield redis.flushdb()

    eb = flexmock()

    def configure(binder):
        binder.bind(txredisapi.Connection, redis)
        binder.bind(EventBus, eb)

    with inject_services(configure):
        controller = DeploymentController()

        eb.should_receive('fire_event').times(3)
        yield controller.create('foo', None)

        r = yield controller.get('foo')
        assert r.public_app is None

        yield controller.publish_app('foo', 'bar')

        r = yield controller.get('foo')
        assert r.public_app == 'bar.foo'

        yield controller.unpublish_app('foo')

        r = yield controller.get('foo')
        assert r.public_app is None
Esempio n. 2
0
def test_deployment_controller_publish_app():

    redis = yield txredisapi.Connection(dbid=2)
    yield redis.flushdb()

    eb = flexmock()

    def configure(binder):
        binder.bind(txredisapi.Connection, redis)
        binder.bind(EventBus, eb)

    with inject_services(configure):
        controller = DeploymentController()

        eb.should_receive('fire_event').times(3)
        yield controller.create('foo', None)

        r = yield controller.get('foo')
        assert r.public_app is None

        yield controller.publish_app('foo', 'bar')

        r = yield controller.get('foo')
        assert r.public_app == 'bar.foo'

        yield controller.unpublish_app('foo')

        r = yield controller.get('foo')
        assert r.public_app is None