forked from ckan/ckan
-
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.
Merge pull request ckan#6469 from ckan/faster-tests
Faster tests
- Loading branch information
Showing
82 changed files
with
1,524 additions
and
1,437 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
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -8,7 +8,7 @@ | |
from ckan.tests import factories | ||
|
||
|
||
@pytest.mark.usefixtures(u"clean_db") | ||
@pytest.mark.usefixtures("non_clean_db") | ||
class TestUserAdd(object): | ||
|
||
def test_cli_user_add_valid_args(self, cli): | ||
|
@@ -17,10 +17,10 @@ def test_cli_user_add_valid_args(self, cli): | |
args = [ | ||
u"user", | ||
u"add", | ||
u"berty", | ||
factories.User.stub().name, | ||
u"password=password123", | ||
u"fullname=Berty Guffball", | ||
u"email=[email protected]", | ||
u"email=" + factories.User.stub().email, | ||
] | ||
result = cli.invoke(ckan, args) | ||
|
||
|
@@ -38,9 +38,9 @@ def test_cli_user_add_no_fullname(self, cli): | |
args = [ | ||
u"user", | ||
u"add", | ||
u"berty", | ||
factories.User.stub().name, | ||
u"password=password123", | ||
u"email=[email protected]", | ||
u"email=" + factories.User.stub().email, | ||
] | ||
result = cli.invoke(ckan, args) | ||
|
||
|
@@ -54,10 +54,10 @@ def test_cli_user_add_unicode_fullname_unicode_decode_error(self, cli): | |
args = [ | ||
u"user", | ||
u"add", | ||
u"berty", | ||
factories.User.stub().name, | ||
u"password=password123", | ||
u"fullname=Harold Müffintøp", | ||
u"email=[email protected]", | ||
u"email=" + factories.User.stub().email, | ||
] | ||
result = cli.invoke(ckan, args) | ||
assert not result.exit_code, result.output | ||
|
@@ -70,16 +70,16 @@ def test_cli_user_add_unicode_fullname_system_exit(self, cli): | |
args = [ | ||
u"user", | ||
u"add", | ||
u"berty", | ||
factories.User.stub().name, | ||
u"password=password123", | ||
u"fullname=Harold Müffintøp", | ||
u"email=[email protected]", | ||
u"email=" + factories.User.stub().email, | ||
] | ||
result = cli.invoke(ckan, args) | ||
assert not result.exit_code, result.output | ||
|
||
|
||
@pytest.mark.usefixtures(u"clean_db") | ||
@pytest.mark.usefixtures(u"non_clean_db") | ||
class TestApiToken(object): | ||
|
||
def test_revoke(self, cli): | ||
|
@@ -110,8 +110,9 @@ def test_list(self, cli): | |
] | ||
result = cli.invoke(ckan, args) | ||
assert not result.exit_code, result.output | ||
for (id,) in model.Session.query(model.ApiToken.id): | ||
assert id in result.output | ||
tokens = model.Session.query(model.ApiToken.id).filter_by( | ||
user_id=user["id"]) | ||
assert all(token.id in result.output for token in tokens) | ||
|
||
def test_add_with_extras(self, cli): | ||
"""Command shouldn't raise SystemExit when valid args are provided. | ||
|
@@ -126,10 +127,10 @@ def test_add_with_extras(self, cli): | |
u"""--json={"x": "y"}""", | ||
] | ||
|
||
assert model.Session.query(model.ApiToken).count() == 0 | ||
initial = model.Session.query(model.ApiToken).count() | ||
result = cli.invoke(ckan, args) | ||
assert not result.exit_code, result.output | ||
assert model.Session.query(model.ApiToken).count() == 1 | ||
assert model.Session.query(model.ApiToken).count() == initial + 1 | ||
|
||
args = [ | ||
u"user", | ||
|
@@ -143,7 +144,7 @@ def test_add_with_extras(self, cli): | |
|
||
result = cli.invoke(ckan, args) | ||
assert not result.exit_code, result.output | ||
assert model.Session.query(model.ApiToken).count() == 2 | ||
assert model.Session.query(model.ApiToken).count() == initial + 2 | ||
|
||
args = [ | ||
u"user", | ||
|
@@ -157,4 +158,4 @@ def test_add_with_extras(self, cli): | |
|
||
result = cli.invoke(ckan, args) | ||
assert result.exit_code == 1 | ||
assert model.Session.query(model.ApiToken).count() == 2 | ||
assert model.Session.query(model.ApiToken).count() == initial + 2 |
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
Oops, something went wrong.