-
Notifications
You must be signed in to change notification settings - Fork 29
✨ allowing to log back into a study when the tab was closed #2383
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
sanderegg
merged 57 commits into
ITISFoundation:master
from
sanderegg:enhancement/allow_relogin_in_same_account
Jun 18, 2021
Merged
Changes from 55 commits
Commits
Show all changes
57 commits
Select commit
Hold shift + click to select a range
8b3b54a
nicer output
sanderegg 93142ec
remove outdated todo
sanderegg 0a42c05
allow logging in again when same user closed all tabs pointing to a s…
sanderegg cb88e8c
typo
sanderegg c246305
removed signal observer since import are already there
sanderegg 30abfd5
updated schema for project state
sanderegg bd2b8e0
lock project when closing
sanderegg 07f5288
set up project status
sanderegg 527b7d2
some missing entries for the tests
sanderegg 3861165
define project key
sanderegg 7bb5f86
create a second client to access lock keys
sanderegg acef1c4
create constant for redis lock keys
sanderegg 7ee32ef
constant for redis client for lock db
sanderegg 6b6070c
notification when closing
sanderegg e88ae0e
adding the OPENING state
sanderegg 1bd0c09
have some feedback at least
sanderegg 8d3e8a4
steal project when opening from a disconnected same user
sanderegg d72eb26
simplify
sanderegg f0e5e58
missing status in project locked structure
sanderegg dc4afc8
fix unit test: missign ;
sanderegg d76abc8
fix unit test: missing required status value
sanderegg 018deab
partly fixed
sanderegg 6152c9a
fix unit test: missing semicolon
sanderegg b610754
pass client session id in state endpoint
sanderegg 1f4c204
return OPENED, it's too complex to notify all clients with something …
sanderegg d2018a5
disallow opening the same project from 2 different tabs
sanderegg 618518f
disallow opening 2 tabs on same project
sanderegg ab1942e
ensure redis database is properly cleaned
sanderegg ca67216
removed coveralls
sanderegg 31006c9
ensure redis database is cleaned
sanderegg 74676a3
added migration validator
sanderegg 235b3ef
nicer
sanderegg b8ce571
removed coveralls
sanderegg 203b7f6
use constant
sanderegg ff3f8ba
removed need of client session id in project/state endpoint
sanderegg e7655ae
fully test project locked
sanderegg ef00b4b
linter
sanderegg 9bd89f7
making calls simpler?
sanderegg 16cb365
linter
sanderegg 83fe02c
missing the non called coroutine
sanderegg 25a73b2
removed unnecesary try catch
sanderegg d5d8925
use relative imports
sanderegg 4839dca
relative imports
sanderegg f602edb
one function for notifications
sanderegg c8270aa
added lock for cloning and exporting
sanderegg eda183c
ensure the state is set back to normal
sanderegg 6914124
make notification optional when deleting the project
sanderegg db111af
needed to mock the notification subsystem there
sanderegg b70892e
@pcrespov @gitHK reviews: added tests to prevent different patterns b…
sanderegg dbfc512
@pcrespov review: added more auto validation
sanderegg 5085659
@GitHK review: move _MIGRATION_FLAGS where it belongs
sanderegg db8069a
@pcrespov review: naming
sanderegg 8ef3f23
@pcrespov review: user parse_obj
sanderegg 4b8ac7b
@pcrespov review: add more docs
sanderegg 792d4a7
@GitHK review: prepare context manager for easier usage once py3.8 is in
sanderegg 3ed4b33
@pcrespov review: use namedtuple
sanderegg 260612c
so that the GC does not delete guest users we call it manually
sanderegg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,35 @@ | ||
from pprint import pformat | ||
|
||
import pytest | ||
from models_library.projects_state import ProjectLocked, ProjectStatus | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"model_cls", | ||
(ProjectLocked,), | ||
) | ||
def test_projects_state_model_examples(model_cls, model_cls_examples): | ||
for name, example in model_cls_examples.items(): | ||
print(name, ":", pformat(example)) | ||
model_instance = model_cls(**example) | ||
assert model_instance, f"Failed with {name}" | ||
|
||
|
||
def test_project_locked_with_missing_owner_raises(): | ||
with pytest.raises(ValueError): | ||
ProjectLocked(**{"value": True, "status": ProjectStatus.OPENED}) | ||
sanderegg marked this conversation as resolved.
Show resolved
Hide resolved
|
||
ProjectLocked.parse_obj({"value": False, "status": ProjectStatus.OPENED}) | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"lock, status", | ||
[ | ||
(False, x) | ||
for x in ProjectStatus | ||
if x not in [ProjectStatus.CLOSED, ProjectStatus.OPENED] | ||
] | ||
+ [(True, ProjectStatus.CLOSED)], | ||
) | ||
def test_project_locked_with_allowed_values(lock: bool, status: ProjectStatus): | ||
with pytest.raises(ValueError): | ||
ProjectLocked.parse_obj({"value": lock, "status": status}) |
This file contains hidden or 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 |
---|---|---|
|
@@ -4,10 +4,11 @@ | |
|
||
import re | ||
from pprint import pformat | ||
from typing import Any, Dict | ||
from typing import Any, Callable, Dict, List | ||
|
||
import pytest | ||
import yaml | ||
from models_library.basic_regex import VERSION_RE | ||
from models_library.services import ( | ||
SERVICE_KEY_RE, | ||
ServiceAccessRightsAtDB, | ||
|
@@ -103,7 +104,6 @@ def test_service_models_examples(model_cls, model_cls_examples): | |
assert model_instance, f"Failed with {name}" | ||
|
||
|
||
@pytest.mark.skip(reason="dev") | ||
@pytest.mark.parametrize( | ||
"service_key", | ||
[ | ||
|
@@ -159,7 +159,7 @@ def test_service_models_examples(model_cls, model_cls_examples): | |
[SERVICE_KEY_RE, r"^(simcore)/(services)/(comp|dynamic|frontend)(/[^\s/]+)+$"], | ||
ids=["pattern_with_w", "pattern_with_s"], | ||
) | ||
def test_service_key_regex_patterns(service_key, regex_pattern): | ||
def test_service_key_regex_patterns(service_key: str, regex_pattern: str): | ||
match = re.match(regex_pattern, service_key) | ||
assert match | ||
|
||
|
@@ -178,3 +178,36 @@ def test_services_model_examples(model_cls, model_cls_examples): | |
print(name, ":", pformat(example)) | ||
model_instance = model_cls(**example) | ||
assert model_instance, f"Failed with {name}" | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"python_regex_pattern, json_schema_file_name, json_schema_entry_paths", | ||
[ | ||
(SERVICE_KEY_RE, "project-v0.0.1.json", ["key"]), | ||
(VERSION_RE, "project-v0.0.1.json", ["version"]), | ||
(VERSION_RE, "node-meta-v0.0.1.json", ["version"]), | ||
(SERVICE_KEY_RE, "node-meta-v0.0.1.json", ["key"]), | ||
], | ||
) | ||
def test_regex_pattern_same_in_jsonschema_and_python( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
python_regex_pattern: str, | ||
json_schema_file_name: str, | ||
json_schema_entry_paths: List[str], | ||
json_schema_dict: Callable, | ||
): | ||
# read file in | ||
json_schema_config = json_schema_dict(json_schema_file_name) | ||
# go to keys | ||
def _find_pattern_entry(obj: Dict[str, Any], key: str) -> Any: | ||
if key in obj: | ||
return obj[key]["pattern"] | ||
for v in obj.values(): | ||
if isinstance(v, dict): | ||
item = _find_pattern_entry(v, key) | ||
if item is not None: | ||
return item | ||
return None | ||
|
||
for x_path in json_schema_entry_paths: | ||
json_pattern = _find_pattern_entry(json_schema_config, x_path) | ||
assert json_pattern == python_regex_pattern |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.