Esempio n. 1
0
def test_tubes(c: Client) -> None:
    assert c.tubes() == ["default"]
    c.use("a")
    assert set(c.tubes()) == {"default", "a"}
    c.watch("b")
    c.watch("c")
    assert set(c.tubes()) == {"default", "a", "b", "c"}
Esempio n. 2
0
def test_tubes(c: Client) -> None:
    assert c.tubes() == ['default']
    c.use('a')
    assert set(c.tubes()) == {'default', 'a'}
    c.watch('b')
    c.watch('c')
    assert set(c.tubes()) == {'default', 'a', 'b', 'c'}
Esempio n. 3
0
def test_basic_usage(c: Client) -> None:
    c.use("emails")
    id = c.put("测试@example.com".encode("utf-8"))
    c.watch("emails")
    c.ignore("default")
    job = c.reserve()
    assert id == job.id
    assert job.body.decode("utf-8") == "测试@example.com"
    c.delete(job)
Esempio n. 4
0
def test_initialize_with_tubes(c: Client) -> None:
    c.put(b"www.example.com")
    job = c.reserve()
    assert job.body == b"www.example.com"
    c.delete(job.id)
    c.use("default")
    c.put(b"")
    with pytest.raises(TimedOutError):
        c.reserve(timeout=0)
Esempio n. 5
0
def test_basic_usage(c: Client) -> None:
    c.use('emails')
    id = c.put('测试@example.com')
    c.watch('emails')
    c.ignore('default')
    job = c.reserve()
    assert id == job.id
    assert job.body == '测试@example.com'
    c.delete(job)
Esempio n. 6
0
def test_initialize_with_tubes(c: Client) -> None:
    c.put('www.example.com')
    job = c.reserve()
    assert job.body == 'www.example.com'
    c.delete(job.id)
    c.use('default')
    c.put('')
    with pytest.raises(TimedOutError):
        c.reserve(timeout=0)
Esempio n. 7
0
def test_initialize_watch_multiple(c: Client) -> None:
    c.use("static")
    c.put(b"haskell")
    c.put(b"rust")
    c.use("dynamic")
    c.put(b"python")
    job = c.reserve(timeout=0)
    assert job.body == b"haskell"
    job = c.reserve(timeout=0)
    assert job.body == b"rust"
    job = c.reserve(timeout=0)
    assert job.body == b"python"
Esempio n. 8
0
def test_initialize_watch_multiple(c: Client) -> None:
    c.use('static')
    c.put(b'haskell')
    c.put(b'rust')
    c.use('dynamic')
    c.put(b'python')
    job = c.reserve(timeout=0)
    assert job.body == 'haskell'
    job = c.reserve(timeout=0)
    assert job.body == 'rust'
    job = c.reserve(timeout=0)
    assert job.body == 'python'
Esempio n. 9
0
def test_using(c: Client) -> None:
    assert c.using() == "default"
    c.use("another")
    assert c.using() == "another"
Esempio n. 10
0
def test_using(c: Client) -> None:
    assert c.using() == 'default'
    c.use('another')
    assert c.using() == 'another'