Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
funkwhale
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Zwordi
funkwhale
Commits
1a3e7a5e
Commit
1a3e7a5e
authored
6 years ago
by
gordon
Committed by
Eliot Berriot
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix Factories for dev data
parent
4a9e7fa7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
api/funkwhale_api/factories.py
+22
-0
22 additions, 0 deletions
api/funkwhale_api/factories.py
changes/changelog.d/factories.bugfix
+1
-0
1 addition, 0 deletions
changes/changelog.d/factories.bugfix
with
23 additions
and
0 deletions
api/funkwhale_api/factories.py
+
22
−
0
View file @
1a3e7a5e
import
uuid
import
factory
import
persisting_theory
from
faker.providers
import
internet
as
internet_provider
class
FactoriesRegistry
(
persisting_theory
.
Registry
):
look_into
=
"
factories
"
...
...
@@ -39,3 +42,22 @@ class NoUpdateOnCreate:
@classmethod
def
_after_postgeneration
(
cls
,
instance
,
create
,
results
=
None
):
return
class
FunkwhaleProvider
(
internet_provider
.
Provider
):
"""
Our own faker data generator, since built-in ones are sometimes
not random enough
"""
def
federation_url
(
self
,
prefix
=
""
):
def
path_generator
():
return
"
{}/{}
"
.
format
(
prefix
,
uuid
.
uuid4
())
domain
=
self
.
domain_name
()
protocol
=
"
https
"
path
=
path_generator
()
return
"
{}://{}/{}
"
.
format
(
protocol
,
domain
,
path
)
factory
.
Faker
.
add_provider
(
FunkwhaleProvider
)
This diff is collapsed.
Click to expand it.
changes/changelog.d/factories.bugfix
0 → 100644
+
1
−
0
View file @
1a3e7a5e
Fixed dev command for fake data creation (!664)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment