-
Notifications
You must be signed in to change notification settings - Fork 0
Seeding database with testing data #23
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
Conversation
|
This got a bit bigger than what I was expecting. I added factories to the project that led me to modified the testing files alongside with the seeding file. I implemented the requested changes and they added very useful features into the project. There are a couple of features that I would like to implement into these features but I'll create new issues. I don't want to continue adding into this branch and make it bigger. |
| model = Activity | ||
|
|
||
| actor = factory.SubFactory(ActorFactory) | ||
| type = factory.Iterator(['Create', 'Like', 'Update', 'Follow', 'Announce', 'Delete', 'Undo', 'Flag']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is going to create conformant ActivityPub objects. Some of these types can have a Note attached but some shouldn't. This is fine for this PR but we'll need to iterate. Possibly some of the Activity types should be subclasses of the Activity model class that enforce things like whether the type has a note or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this was something I was going to deal with in the next PR.
| outbox = PortabilityOutbox.objects.create(actor=self) | ||
|
|
||
| # Create an initial Activity for the Actor | ||
| activity = Activity.objects.create( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this supposed to be the activity that announces the creation of the Actor themselves? Is it correct for an Activity of type "Create" to have no internal object?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
Yes, correct. It announces the creation of the Actor itself.
-
No, it shouldn't be that way. I should've added the internal object. The internal object should be the Actor itself.
{
"@context": "https://www.w3.org/ns/activitystreams",
"type": "Create",
"actor": "https://example.com/users/someuser",
"object": {
"type": "Person",
"id": "https://example.com/users/someuser",
"preferredUsername": "someuser",
"name": "Some User",
}
}

Testbed Test Data Seeding
Implements a Django management command to seed the database with test data, creating a network of actors, notes, activities, and outboxes with proper relationships.
Features
Implementation
Data Generation Details
Usage
Run the command using:
Testing
Output:


Closes #22