Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
funkwhale
Manage
Activity
Members
Labels
Plan
Issues
472
Issue boards
Milestones
Wiki
Code
Merge requests
11
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
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
funkwhale
funkwhale
Merge requests
!664
Fix Factories for dev data
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Fix Factories for dev data
gordon/funkwhale:fix-factories
into
develop
Overview
0
Commits
1
Pipelines
3
Changes
2
Merged
gordon
requested to merge
gordon/funkwhale:fix-factories
into
develop
5 years ago
Overview
0
Commits
1
Pipelines
3
Changes
2
Expand
This Merge Request includes:
Tests
A changelog fragment (cf
https://docs.funkwhale.audio/contributing.html#changelog-management
)
👍
0
👎
0
Merge request reports
Compare
develop
version 2
150162be
5 years ago
version 1
1ba72438
5 years ago
develop (base)
and
latest version
latest version
76cb0483
1 commit,
5 years ago
version 2
150162be
1 commit,
5 years ago
version 1
1ba72438
1 commit,
5 years ago
2 files
+
23
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
api/funkwhale_api/factories.py
+
22
−
0
Options
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
)
Loading