File: test_event.py

package info (click to toggle)
python-consul 1.6.0-1~exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 484 kB
  • sloc: python: 2,858; makefile: 197
file content (19 lines) | stat: -rw-r--r-- 710 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
class TestEvent:
    def test_event(self, consul_obj) -> None:
        c, _consul_version = consul_obj

        assert c.event.fire("fooname", "foobody")
        _index, events = c.event.list()
        assert [x["Name"] == "fooname" for x in events]
        assert [x["Payload"] == "foobody" for x in events]

    def test_event_targeted(self, consul_obj) -> None:
        c, _consul_version = consul_obj

        assert c.event.fire("fooname", "foobody")
        _index, events = c.event.list(name="othername")
        assert events == []

        _index, events = c.event.list(name="fooname")
        assert [x["Name"] == "fooname" for x in events]
        assert [x["Payload"] == "foobody" for x in events]