-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
adbae66
commit dd3406e
Showing
21 changed files
with
497 additions
and
254 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 |
---|---|---|
|
@@ -45,6 +45,7 @@ nosetests.xml | |
coverage.xml | ||
*.cover | ||
.hypothesis/ | ||
.pytest_cache | ||
|
||
# Translations | ||
*.mo | ||
|
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 |
---|---|---|
@@ -1,13 +1,13 @@ | ||
blessings==1.6.1 | ||
colorama==0.3.9 | ||
coverage==4.5.1 | ||
mypy==0.570 | ||
pyfakefs==3.4 | ||
pylint==1.8.2 | ||
pytest==3.4.2 | ||
pytest-bdd==2.20.0 | ||
mypy==0.590 | ||
peewee==3.2.4 | ||
pyfakefs==3.4.1 | ||
pylint==1.8.4 | ||
pytest==3.5.0 | ||
pytest-bdd==2.21.0 | ||
pytest-cov==2.5.1 | ||
pytest-mypy==0.3.0 | ||
pytest-pylint==0.9.0 | ||
python-dateutil==2.7.2 | ||
tabulate==0.8.2 | ||
python-dateutil==2.7.0 |
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
blessings==1.6.1 | ||
colorama==0.3.9 | ||
peewee==3.2.4 | ||
python-dateutil==2.7.2 | ||
tabulate==0.8.2 | ||
python-dateutil==2.7.0 |
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
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
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
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,42 @@ | ||
Feature: Store VtES journal in a database | ||
|
||
Scenario: Add game to a database | ||
When I invoke vtes add with --journal-db | ||
And I specify players with decks | ||
And I submit the command | ||
Then command finishes successfully | ||
|
||
Scenario: List games from a database | ||
Given I logged five games to database | ||
When I invoke vtes games with --journal-db | ||
And I submit the command | ||
Then command finishes successfully | ||
And five games are listed | ||
|
||
Scenario: Deck statistics from a database | ||
Given I logged some games to database | ||
When I invoke vtes decks with --journal-db | ||
And I submit the command | ||
Then command finishes successfully | ||
And deck statistics are listed | ||
|
||
Scenario: General timeline statistics from a database | ||
Given I logged some games to database | ||
When I invoke vtes stats with --journal-db | ||
And I submit the command | ||
Then command finishes successfully | ||
And player rankings are listed | ||
|
||
Scenario: Database and pickle are mutually exclusive | ||
When I invoke vtes add with --journal-db and --journal-file | ||
And I specify players with decks | ||
And I submit the command | ||
Then command finishes unsuccessfully | ||
|
||
# This will need Games to have IDs | ||
# Scenario: Fix existing game in a database | ||
# Given I logged some games to database | ||
# When I change game 1 with --journal-db | ||
# And I submit the command | ||
# Then command finishes successfully | ||
# Then game is changed |
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
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
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
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,46 @@ | ||
# missing-docstring, because we do not need docstring for each test method | ||
# redefined-outer-name: fixtures unfortunately trigger this | ||
# pylint: disable=missing-docstring, redefined-outer-name, unused-import | ||
|
||
from pytest_bdd import given, when, then, scenarios | ||
from tests.fixtures.commands import vtes_command, five_games | ||
|
||
scenarios('features/database.feature') | ||
|
||
@when('I invoke vtes add with --journal-db and --journal-file') | ||
def pickle_and_db(tmpdir, vtes_command): | ||
# pylint: disable=protected-access | ||
vtes_command._storage = ('--journal-file', tmpdir / 'file', '--journal-db', tmpdir / 'file.db') | ||
|
||
@given('I logged five games to database') | ||
@given('I logged some games to database') | ||
def log_some_games(tmpdir, five_games): | ||
for game in five_games: | ||
command = vtes_command(tmpdir).with_database().add().with_arguments(game).execute() | ||
assert command.completed.returncode == 0 | ||
|
||
@when('I invoke vtes stats with --journal-db') | ||
def vtes_stats(vtes_command): | ||
vtes_command.with_database().stats() | ||
|
||
@when('I invoke vtes add with --journal-db') | ||
def vtes_add_db(vtes_command): | ||
vtes_command.with_database().add() | ||
|
||
@when('I invoke vtes games with --journal-db') | ||
def vtes_games(vtes_command): | ||
vtes_command.with_database().games() | ||
|
||
@when('I invoke vtes decks with --journal-db') | ||
def vtes_decks(vtes_command): | ||
vtes_command.with_database().decks() | ||
|
||
@then('five games are listed') | ||
def five_games_listed(vtes_command): | ||
output = [line for line in vtes_command.completed.stdout.split("\n") if line] | ||
assert len(output) == 5 | ||
|
||
@when('I change game 1 with --journal-db') | ||
def change_game_1(vtes_command): | ||
vtes_command.with_database().gamefix().with_arguments(("1", "Felipe(dECK):0", "aFRI(Deck):0", | ||
"XZealot(Deck):3", "Cooper(Deck):1")) |
Oops, something went wrong.