Guide an small auto-tag fix

This commit is contained in:
2026-08-05 21:12:19 -05:00
parent 175e5b08d2
commit 6be4578cb9
3 changed files with 88 additions and 0 deletions
+21
View File
@@ -135,6 +135,27 @@ class UGCProjectTests(UGCMediaTestCase, UGCGatedTestCase):
creator_cat = TagCategory.objects.get(slug='creator')
self.assertTrue(Tag.objects.filter(name='alice', category=creator_cat).exists())
def test_create_links_auto_tags(self):
"""Auto tags (from version metadata) must be linked to the project on
creation, not just created as orphan Tag rows."""
self.gate()
self.client.login(username='Alice', password='pw')
uuid = self.client.get(reverse('library:project_create_new')).url.rstrip('/').split('/')[-1]
self._upload_temp(
'version', 'testmod.jar',
_zip_bytes({'META-INF/mods.toml': 'modLoader="javafml"\nloaderVersion="[1,)"\n[[mods]]\nmodId="testmod"\nversion="1.0.0"\ndisplayName="Test Mod"\n'}),
'application/java-archive',
draft_uuid=uuid,
)
self.client.post(reverse('library:project_create', args=[uuid]), {
'title': 'Auto Tag Mod', 'category': 'mod', 'version_name': '1.0.0',
})
project = Project.objects.get(slug='auto-tag-mod')
loader_links = TagList.objects.filter(
project=project, tag__category__slug='loader',
)
self.assertTrue(loader_links.exists(), 'auto loader tag should be linked to the project')
def test_create_requires_version_file(self):
self.gate()
self.client.login(username='Alice', password='pw')