-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- add "" around db names so bad names with spaces at end or start can be identified - check that no bad templates can be generated
- Loading branch information
Showing
6 changed files
with
104 additions
and
8 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
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,63 @@ | ||
import os | ||
|
||
import pytest | ||
|
||
import edgy | ||
from edgy import Instance | ||
from edgy.contrib.permissions import BasePermission | ||
from tests.settings import TEST_ALTERNATIVE_DATABASE, TEST_DATABASE | ||
|
||
pytestmark = pytest.mark.anyio | ||
models = edgy.Registry( | ||
database=TEST_DATABASE, | ||
extra={"ano ther ": TEST_ALTERNATIVE_DATABASE}, | ||
with_content_type=True, | ||
) | ||
basedir = os.path.abspath(os.path.dirname(__file__)) | ||
|
||
|
||
class User(edgy.StrictModel): | ||
name = edgy.fields.CharField(max_length=100) | ||
|
||
class Meta: | ||
registry = models | ||
|
||
|
||
class Group(edgy.StrictModel): | ||
name = edgy.fields.CharField(max_length=100) | ||
users = edgy.fields.ManyToMany("User", embed_through=False) | ||
|
||
class Meta: | ||
registry = models | ||
|
||
|
||
class Permission(BasePermission): | ||
users = edgy.fields.ManyToMany("User", embed_through=False) | ||
groups = edgy.fields.ManyToMany("Group", embed_through=False) | ||
name_model: str = edgy.fields.CharField(max_length=100, null=True) | ||
obj = edgy.fields.ForeignKey("ContentType", null=True) | ||
|
||
class Meta: | ||
registry = models | ||
unique_together = [("name", "name_model", "obj")] | ||
|
||
|
||
class Signal(edgy.StrictModel): | ||
user = edgy.fields.ForeignKey(User, no_constraint=True) | ||
signal_type = edgy.fields.CharField(max_length=100) | ||
database = models.extra["ano ther "] | ||
|
||
class Meta: | ||
registry = models | ||
|
||
|
||
class Unrelated(edgy.StrictModel): | ||
name = edgy.fields.CharField(max_length=100) | ||
database = models.extra["ano ther "] | ||
content_type = edgy.fields.ExcludeField() | ||
|
||
class Meta: | ||
registry = models | ||
|
||
|
||
edgy.monkay.set_instance(Instance(registry=models)) |
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,7 @@ | ||
from typing import Union | ||
|
||
from edgy.conf.global_settings import EdgySettings | ||
|
||
|
||
class TestSettings(EdgySettings): | ||
migrate_databases: list[Union[str, None]] = [None, "ano ther "] |