@@ -243,3 +243,138 @@ Scenario: History::recent_changes() accepts "all_advisories" option
243243 downgraded: 0
244244 removed: 0
245245 """
246+
247+
248+ Scenario : History::list() all transactions by default
249+ When I execute python libdnf5 dbus api script with history interface
250+ """
251+ options = {{
252+ }}
253+
254+ transactions = iface_history.list(options)
255+ for k in transactions:
256+ # print id and last two words of transaction description
257+ print(str(k.get("id")) + " " + " ".join(k.get("description").split()[-2:]))
258+ """
259+ Then the exit code is 0
260+ And stdout is
261+ """
262+ 6 remove labirinto
263+ 5 downgrade fragola
264+ 4 upgrade fragola
265+ 3 install labirinto
266+ 2 upgrade fragola-2
267+ 1 install fragola-1
268+ """
269+
270+
271+ Scenario : History::list() reversed with a limit
272+ When I execute python libdnf5 dbus api script with history interface
273+ """
274+ options = {{
275+ "reverse": True,
276+ "limit": dbus.Int64(3)
277+ }}
278+
279+ transactions = iface_history.list(options)
280+ for k in transactions:
281+ # print id and last two words of transaction description
282+ print(str(k.get("id")) + " " + " ".join(k.get("description").split()[-2:]))
283+ """
284+ Then the exit code is 0
285+ And stdout is
286+ """
287+ 1 install fragola-1
288+ 2 upgrade fragola-2
289+ 3 install labirinto
290+ """
291+
292+
293+ Scenario : History::list() with specified package
294+ When I execute python libdnf5 dbus api script with history interface
295+ """
296+ options = {{
297+ "contains_pkgs": ["fragola"],
298+ }}
299+
300+ transactions = iface_history.list(options)
301+ for k in transactions:
302+ # print id and last two words of transaction description
303+ print(str(k.get("id")) + " " + " ".join(k.get("description").split()[-2:]))
304+ """
305+ Then the exit code is 0
306+ And stdout is
307+ """
308+ 5 downgrade fragola
309+ 4 upgrade fragola
310+ 2 upgrade fragola-2
311+ 1 install fragola-1
312+ """
313+
314+
315+ Scenario : History::list() since timestamp
316+ When I execute python libdnf5 dbus api script with history interface
317+ """
318+ options = {{
319+ "since": dbus.Int64(40)
320+ }}
321+
322+ transactions = iface_history.list(options)
323+ for k in transactions:
324+ # print id and last two words of transaction description
325+ print(str(k.get("id")) + " " + " ".join(k.get("description").split()[-2:]))
326+ """
327+ Then the exit code is 0
328+ And stdout is
329+ """
330+ 6 remove labirinto
331+ 5 downgrade fragola
332+ """
333+
334+
335+ Scenario : History::list() without packages and limited transaction attributes
336+ When I execute python libdnf5 dbus api script with history interface
337+ """
338+ options = {{
339+ "transaction_attrs": ["id"],
340+ "include_packages": False
341+ }}
342+
343+ transactions = dbus_to_python(iface_history.list(options))
344+ for k in transactions:
345+ print(k)
346+ """
347+ Then the exit code is 0
348+ And stdout is
349+ """
350+ {{'id': 6}}
351+ {{'id': 5}}
352+ {{'id': 4}}
353+ {{'id': 3}}
354+ {{'id': 2}}
355+ {{'id': 1}}
356+ """
357+
358+
359+ Scenario : History::list() with limited package attributes and limited transaction attributes
360+ When I execute python libdnf5 dbus api script with history interface
361+ """
362+ options = {{
363+ "transaction_attrs": ["id"],
364+ "package_attrs": ["name"]
365+ }}
366+
367+ transactions = dbus_to_python(iface_history.list(options))
368+ for k in transactions:
369+ print(k)
370+ """
371+ Then the exit code is 0
372+ And stdout is
373+ """
374+ {{'downgraded': [], 'id': 6, 'installed': [], 'reinstalled': [], 'removed': [{{'name': 'labirinto'}}], 'upgraded': []}}
375+ {{'downgraded': [{{'name': 'fragola', 'original_evr': '4-1'}}], 'id': 5, 'installed': [], 'reinstalled': [], 'removed': [], 'upgraded': []}}
376+ {{'downgraded': [], 'id': 4, 'installed': [], 'reinstalled': [], 'removed': [], 'upgraded': [{{'name': 'fragola', 'original_evr': '2-1'}}]}}
377+ {{'downgraded': [], 'id': 3, 'installed': [{{'name': 'labirinto'}}], 'reinstalled': [], 'removed': [], 'upgraded': []}}
378+ {{'downgraded': [], 'id': 2, 'installed': [], 'reinstalled': [], 'removed': [], 'upgraded': [{{'name': 'fragola', 'original_evr': '1-1'}}]}}
379+ {{'downgraded': [], 'id': 1, 'installed': [{{'name': 'fragola'}}], 'reinstalled': [], 'removed': [], 'upgraded': []}}
380+ """
0 commit comments