Mercurial > libervia-backend
comparison tests/e2e/libervia-cli/test_libervia-cli.py @ 3715:b9718216a1c0 0.9
merge bookmark 0.9
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 01 Dec 2021 16:13:31 +0100 |
parents | eeb8be32d644 |
children | 7e51cfc36d4e |
comparison
equal
deleted
inserted
replaced
3714:af09b5aaa5d7 | 3715:b9718216a1c0 |
---|---|
139 built_uri = li.pubsub.uri( | 139 built_uri = li.pubsub.uri( |
140 service="pubsub.example.net", node="some_node", item="some_item" | 140 service="pubsub.example.net", node="some_node", item="some_item" |
141 ).strip() | 141 ).strip() |
142 assert built_uri == "xmpp:pubsub.example.net?;node=some_node;item=some_item" | 142 assert built_uri == "xmpp:pubsub.example.net?;node=some_node;item=some_item" |
143 | 143 |
144 def test_cache_search(self, li_json): | |
145 """A Full-Text Search query can be done""" | |
146 sk_txt = "this is a blog post about Slovakia" | |
147 fr_txt = "this is a blog post about France" | |
148 nc_txt = "this is a blog post about New Caledonia" | |
149 au_txt = "this is a blog post about Australia" | |
150 li.blog.set( | |
151 "-t", "travel", "-t", "europe", | |
152 _in=sk_txt, | |
153 syntax="markdown" | |
154 ) | |
155 li.blog.set( | |
156 "-t", "travel", "-t", "europe", | |
157 _in=fr_txt, | |
158 syntax="markdown" | |
159 ) | |
160 li.blog.set( | |
161 "-t", "travel", "-t", "south pacific", | |
162 _in=nc_txt, | |
163 syntax="markdown" | |
164 ) | |
165 li.blog.set( | |
166 "-t", "travel", "-t", "south pacific", | |
167 _in="this is a blog post about Australia", | |
168 title=au_txt, | |
169 syntax="markdown" | |
170 ) | |
171 # we get the blog to be activate the cache for it | |
172 li.blog.get(max_items=1) | |
173 # FTS | |
174 found = li_json.pubsub.cache.search(type="blog", fts='Slovakia OR "New Caledonia"') | |
175 assert len(found) == 2 | |
176 assert all(i["content"] in (sk_txt, nc_txt) for i in found) | |
177 # search by field | |
178 found = li_json.pubsub.cache.search("-F", "tags", "overlap", "travel", type="blog") | |
179 assert len(found) == 4 | |
180 found = li_json.pubsub.cache.search("-F", "tags", "overlap", "europe", type="blog") | |
181 assert len(found) == 2 | |
182 assert all(i["content"] in (sk_txt, fr_txt) for i in found) | |
183 found = li_json.pubsub.cache.search("-F", "tags", "ioverlap", "SOUTH PACIFIC", type="blog") | |
184 assert all(i["content"] in (nc_txt, au_txt) for i in found) | |
185 | |
144 | 186 |
145 class TestLiberviaCliBlog: | 187 class TestLiberviaCliBlog: |
146 MICROBLOG_NS = "urn:xmpp:microblog:0" | 188 MICROBLOG_NS = "urn:xmpp:microblog:0" |
147 | 189 |
148 def test_set_get(self, li_json): | 190 def test_set_get(self, li_json): |