Example #1
0
def test_ChannelTimeout():
    channel = "test"
    host = "localhost"
    s = Channel(host, channel)

    r = s.read(blocking=True, timeout=1)

    assert not r, "should go timeout"
Example #2
0
    def test_ChannelRandom(self):
        global count
        channel = id_generator()
        host = "localhost"

        s = Channel(host, channel)
        c1 = Channel(host, channel + ".c1")

        messages = [ id_generator(size=1000) for i in range(10)]

        for m in messages:
            c1.write(m)

        for m in messages:
            r = c1.read()
            assert(m == r)
Example #3
0
    def test_ChannelRandom(self):
        global count
        channel = id_generator()
        host = "localhost"

        s = Channel(host, channel)
        c1 = Channel(host, channel + ".c1")

        messages = [id_generator(size=1000) for i in range(10)]

        for m in messages:
            c1.write(m)

        for m in messages:
            r = c1.read()
            assert (m == r)
Example #4
0
    def test_ChannelList(self):
        global count
        channel = "response"
        host = "localhost"

        s = Channel(host, channel)
        c1 = Channel(host, channel + ".c1")
        c2 = Channel(host, channel + ".c2")

        c1.write("START")
        c2.write("START")

        rc1 = c1.read()
        rc2 = c2.read()

        s.write("+STARTED C1")
        s.write("+STARTED C2")

        r3 = s.read()
        r4 = s.read()

        assert rc1 == "START", "not a START: %s" % rc1
        assert (rc2 == "START")
        assert (r3 == "+STARTED C1")
        assert (r4 == "+STARTED C2")
Example #5
0
 def test_ChannelTimeout(self):
     channel = "test"
     host = "localhost"
     s = Channel(host, channel)
     r = s.read(blocking=True, timeout=1)
     assert r is None
Example #6
0
    def test_ChannelList(self):
        global count
        channel = "response"
        host = "localhost"

        s = Channel(host, channel)
        c1 = Channel(host, channel + ".c1")
        c2 = Channel(host, channel + ".c2")

        c1.write("START")
        c2.write("START")

        rc1 = c1.read()
        rc2 = c2.read()

        s.write("+STARTED C1")
        s.write("+STARTED C2")

        r3 = s.read()
        r4 = s.read()

        assert rc1 == "START", "not a START: %s" % rc1
        assert(rc2 == "START")
        assert(r3 == "+STARTED C1")
        assert(r4 == "+STARTED C2")
Example #7
0
 def test_ChannelTimeout(self):
     channel = "test"
     host = "localhost"
     s = Channel(host, channel)
     r = s.read(blocking=True, timeout=1)
     assert r is None