Merge pull request #3460 from hughrun/3426

fix failing test from #3432
This commit is contained in:
Mouse Reeve 2024-10-20 18:50:46 -07:00 committed by GitHub
commit d16faac6da
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -155,9 +155,19 @@ class BaseActivity(TestCase):
result = resolve_remote_id( result = resolve_remote_id(
"https://example.com/user/moose", model=models.User "https://example.com/user/moose", model=models.User
) )
self.assertTrue(
models.User.objects.filter(
remote_id="https://example.com/user/moose"
).exists()
) # moose has been added to DB
self.assertTrue(
models.User.objects.filter(
remote_id="https://example.com/user/ali"
).exists()
) # Ali has been added to DB
self.assertIsInstance(result, models.User) self.assertIsInstance(result, models.User)
self.assertEqual(result.name, "moose?? moose!!") self.assertEqual(result.name, "moose?? moose!!")
self.assertEqual(models.User.objects.count(), 3) # created moose plus the alias
alias = models.User.objects.last() alias = models.User.objects.last()
self.assertEqual(alias.name, "Ali As") self.assertEqual(alias.name, "Ali As")
self.assertEqual(result.also_known_as.first(), alias) # Ali is alias of Moose self.assertEqual(result.also_known_as.first(), alias) # Ali is alias of Moose