Ejemplo n.º 1
0
def test_consumer_register():
    app = TestConsumer(__name__, "/my/name")

    # Register a method of name "get_baz" to fetch data with
    # the name "/foo/bar/baz"

    app.register("get_baz", "/foo/bar/baz")
    got = app.get_baz()

    hasher = Hasher()
    hash_input = "/foo/bar/baz"
    expected = hasher.hash(hash_input)

    print got
    print expected
    assert got == expected
Ejemplo n.º 2
0
def test_consumer_register():
    app = TestConsumer(__name__, "/my/name")

    # Register a method of name "get_baz" to fetch data with
    # the name "/foo/bar/baz"

    app.register("get_baz", "/foo/bar/baz")
    got = app.get_baz()

    hasher = Hasher()
    hash_input = "/foo/bar/baz"
    expected = hasher.hash(hash_input)

    print got
    print expected
    assert got == expected
Ejemplo n.º 3
0
def test_consumer_install_rpc():
    app = TestConsumer(__name__, "/my/name")

    test_payload = "cool payload"

    # @app.install
    @app.install_rpc("/foo/bar/car")
    def get_car():
        return test_payload

    got = get_car()

    hasher = Hasher()
    hash_input = "/foo/bar/car" + test_payload
    expected = hasher.hash(hash_input)

    assert got == expected
Ejemplo n.º 4
0
def test_consumer_install_rpc():
    app = TestConsumer(__name__, "/my/name")

    test_payload = "cool payload"

    # @app.install
    @app.install_rpc("/foo/bar/car")
    def get_car():
        return test_payload

    got = get_car()

    hasher = Hasher()
    hash_input = "/foo/bar/car" + test_payload
    expected = hasher.hash(hash_input)

    assert got == expected
Ejemplo n.º 5
0
def test_consumer_install_sink():
    app = TestConsumer(__name__, "/my/name")

    test_payload = "cool payload"

    # @app.install
    @app.install_sink("/foo/bar/car")
    def get_car():
        return "random"

    got = get_car()

    input_name = "/foo/bar/car/random"
    hasher = Hasher()
    print input_name
    expected = hasher.hash(input_name + "")

    print got, expected

    assert got == expected
Ejemplo n.º 6
0
def test_consumer_install_sink():
    app = TestConsumer(__name__, "/my/name")

    test_payload = "cool payload"

    # @app.install
    @app.install_sink("/foo/bar/car")
    def get_car():
        return "random"

    got = get_car()

    input_name = "/foo/bar/car/random"
    hasher = Hasher()
    print input_name
    expected = hasher.hash(input_name + "")

    print got, expected

    assert got == expected