-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
Feature: DNF/Behave test Transaction history - base | ||
|
||
Scenario: Simple transaction | ||
Given I use the repository "test-1" | ||
When I execute "dnf" command "install -y TestA" with "success" | ||
Then transaction changes are as follows | ||
| State | Packages | | ||
| installed | TestA, TestB | | ||
When I execute "dnf" command "history" with "success" | ||
Then the history should contain command "install -y TestA" and action "Install" with "2" packages | ||
|
||
Scenario: Undo last transaction | ||
Given I use the repository "test-1" | ||
When I execute "dnf" command "history undo last -y" with "success" | ||
Then transaction changes are as follows | ||
| State | Packages | | ||
| removed | TestA, TestB | | ||
When I execute "dnf" command "history" with "success" | ||
Then the history should contain command "history undo last -y" and action "Erase" with "2" packages | ||
|
||
Scenario: Undo transaction last 2 | ||
Given I use the repository "test-1" | ||
When I execute "dnf" command "history undo last -y" with "success" | ||
Then transaction changes are as follows | ||
| State | Packages | | ||
| installed | TestA, TestB | | ||
When I execute "dnf" command "history" with "success" | ||
Then the history should contain command "history undo last -y" and action "Install" with "2" packages | ||
|
||
Scenario: Undo transaction last-2 | ||
Given I use the repository "test-1" | ||
When I execute "dnf" command "history undo last-2 -y" with "success" | ||
Then transaction changes are as follows | ||
| State | Packages | | ||
| removed | TestA, TestB | | ||
When I execute "dnf" command "history" with "success" | ||
Then the history should contain command "history undo last-2 -y" and action "Erase" with "2" packages | ||
|
||
Scenario: Redo transaction last | ||
Given I use the repository "test-1" | ||
When I execute "dnf" command "install -y TestA" with "success" | ||
Then transaction changes are as follows | ||
| State | Packages | | ||
| installed | TestA, TestB | | ||
When I execute "dnf" command "remove -y TestA" with "success" | ||
Then transaction changes are as follows | ||
| State | Packages | | ||
| removed | TestA, TestB | | ||
When I execute "dnf" command "history redo last-1 -y" with "success" | ||
Then transaction changes are as follows | ||
| State | Packages | | ||
| installed | TestA, TestB | | ||
When I execute "dnf" command "history" with "success" | ||
Then the history should contain command "history redo last-1 -y" and action "Install" with "2" packages | ||
When I execute "dnf" command "history redo last-1 -y" with "success" | ||
Then transaction changes are as follows | ||
| State | Packages | | ||
| removed | TestA, TestB | | ||
When I execute "dnf" command "history" with "success" | ||
Then the history should contain command "history redo last-1 -y" and action "Remove" with "2" packages | ||
|
||
Scenario: Update packages | ||
Given I use the repository "test-1" | ||
When I execute "dnf" command "install -y TestA TestD TestH" with "success" | ||
Given I use the repository "upgrade_1" | ||
When I execute "dnf" command "update -y" with "success" | ||
Then transaction changes are as follows | ||
| State | Packages | | ||
| installed | TestD, TestE, TestA, TestB, TestH | | ||
| removed | TestA, TestB, TestD, TestE, TestH | | ||
When I execute "dnf" command "history" with "success" | ||
Then the history should contain command "update -y" and action "Update" with "5" package |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from behave import then | ||
from behave import when | ||
from behave import given | ||
|
||
@then('the history should contain command "{cmdline}" and action "{action}" with "{altered}" package') | ||
@then('the history should contain command "{cmdline}" and action "{action}" with "{altered}" packages') | ||
def then_history_is(context, cmdline, action, altered): | ||
lines = context.cmd_output.split('\n') | ||
assert len(lines) > 3, 'No output' | ||
del lines[:3] | ||
match = False | ||
for line in lines: | ||
columns = line.split('|') | ||
words = [word.strip() for word in columns] | ||
# last member can be e.g. "1 >" | ||
words += words[-1].split() | ||
if set([cmdline, action, altered]).issubset(set(words)): | ||
match = True | ||
break | ||
assert match, '''Command "{}" and action "{}" with "{}" packages not matched! | ||
{}'''.format(cmdline, action, altered, context.cmd_output) |