-
Notifications
You must be signed in to change notification settings - Fork 1
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 #34 from nefarioustim/task/31/clean-api
Provide clean Python API
- Loading branch information
Showing
8 changed files
with
103 additions
and
28 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
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,23 @@ | ||
""" | ||
Test fixtures and configuration for e2e tests. | ||
""" | ||
|
||
import pytest | ||
from sqlalchemy import create_engine | ||
import cerberusauth | ||
from cerberusauth.storage import sql as sqlstorage | ||
|
||
|
||
@pytest.fixture(autouse=True) | ||
def storage_fixture(monkeypatch): | ||
"""Storage fixture for all e2e tests.""" | ||
engine = create_engine('sqlite:///:memory:') | ||
monkeypatch.setattr(sqlstorage, "engine", engine) | ||
|
||
|
||
@pytest.fixture | ||
def cerberus_fixture(): | ||
"""Session fixture for e2e tests.""" | ||
cerberus = cerberusauth.cerberus() | ||
cerberus.create_schema() | ||
return cerberus |
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,16 @@ | ||
""" | ||
E2E tests. | ||
""" | ||
|
||
from sqlalchemy.inspection import inspect | ||
from cerberusauth.schema import sql as sqlschema | ||
|
||
EXPECTED_MODELS = ['user', 'role', 'permission'] | ||
|
||
|
||
def test_schema_creation(cerberus_fixture): | ||
""".""" | ||
assert "sqlite" in str(sqlschema.sqlstorage.engine) | ||
iengine = inspect(sqlschema.sqlstorage.engine) | ||
|
||
assert set(iengine.get_table_names()) == set(EXPECTED_MODELS) |
This file was deleted.
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