-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
2f78bd6
commit 42872d3
Showing
17 changed files
with
546 additions
and
24 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
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 |
---|---|---|
|
@@ -13,6 +13,7 @@ | |
|
||
from validity import models | ||
from validity.compliance.state import StateItem | ||
from validity.fields.encrypted import EncryptedDict | ||
|
||
|
||
DJANGO_MAJOR_VERSION = django.VERSION[:2] | ||
|
@@ -28,6 +29,10 @@ class Meta: | |
model = models.VDataSource | ||
|
||
|
||
class PollingDSFactory(DataSourceFactory): | ||
type = "device_polling" | ||
|
||
|
||
class DataFileFactory(DjangoModelFactory): | ||
source = factory.SubFactory(DataSourceFactory) | ||
path = factory.Sequence(lambda n: f"file-{n}.txt") | ||
|
@@ -236,6 +241,18 @@ class Meta: | |
model = models.Poller | ||
|
||
|
||
class BackupPointFactory(DjangoModelFactory): | ||
name = factory.sequence(lambda n: f"bp-{n}") | ||
data_source = factory.SubFactory(PollingDSFactory) | ||
backup_after_sync = False | ||
method = "git" | ||
url = "https://site.com/project" | ||
parameters = EncryptedDict({"username": "a", "password": "b"}) | ||
|
||
class Meta: | ||
model = models.BackupPoint | ||
|
||
|
||
class UserFactory(DjangoModelFactory): | ||
email = "[email protected]" | ||
username = "su" | ||
|
@@ -261,6 +278,18 @@ class Meta: | |
model = Job | ||
|
||
|
||
class DSBackupJobFactory(DjangoModelFactory): | ||
name = "DataSourcebackup" | ||
object = factory.SubFactory(BackupPointFactory) | ||
object_id = factory.SelfAttribute("object.pk") | ||
object_type = factory.LazyAttribute(lambda obj: ContentType.objects.get_for_model(type(obj.object))) | ||
user = factory.SubFactory(UserFactory) | ||
job_id = factory.LazyFunction(uuid.uuid4) | ||
|
||
class Meta: | ||
model = Job | ||
|
||
|
||
_NOT_DEFINED = object() | ||
|
||
|
||
|
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.