forked from mirrors/bookwyrm
remove outdated tests
This commit is contained in:
parent
dd985094a5
commit
641ac22786
3 changed files with 5 additions and 47 deletions
|
@ -230,6 +230,8 @@ def image_attachments_formatter(images_json):
|
||||||
caption = image.get('name')
|
caption = image.get('name')
|
||||||
attachment = models.Attachment(caption=caption)
|
attachment = models.Attachment(caption=caption)
|
||||||
image_field = image_formatter(image)
|
image_field = image_formatter(image)
|
||||||
|
if not image_field:
|
||||||
|
continue
|
||||||
attachment.image.save(*image_field, save=False)
|
attachment.image.save(*image_field, save=False)
|
||||||
attachments.append(attachment)
|
attachments.append(attachment)
|
||||||
return attachments
|
return attachments
|
||||||
|
|
|
@ -57,10 +57,9 @@ class SelfConnector(TestCase):
|
||||||
|
|
||||||
def test_search_rank(self):
|
def test_search_rank(self):
|
||||||
results = self.connector.search('Anonymous')
|
results = self.connector.search('Anonymous')
|
||||||
self.assertEqual(len(results), 3)
|
self.assertEqual(len(results), 2)
|
||||||
self.assertEqual(results[0].title, 'Edition of Example Work')
|
self.assertEqual(results[0].title, 'More Editions')
|
||||||
self.assertEqual(results[1].title, 'More Editions')
|
self.assertEqual(results[1].title, 'Edition of Example Work')
|
||||||
self.assertEqual(results[2].title, 'Another Edition')
|
|
||||||
|
|
||||||
|
|
||||||
def test_search_default_filter(self):
|
def test_search_default_filter(self):
|
||||||
|
|
|
@ -21,50 +21,7 @@ class RemoteUser(TestCase):
|
||||||
self.user_data = json.loads(datafile.read_bytes())
|
self.user_data = json.loads(datafile.read_bytes())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def test_get_remote_user(self):
|
def test_get_remote_user(self):
|
||||||
actor = 'https://example.com/users/rat'
|
actor = 'https://example.com/users/rat'
|
||||||
user = remote_user.get_or_create_remote_user(actor)
|
user = remote_user.get_or_create_remote_user(actor)
|
||||||
self.assertEqual(user, self.remote_user)
|
self.assertEqual(user, self.remote_user)
|
||||||
|
|
||||||
|
|
||||||
def test_create_remote_user(self):
|
|
||||||
user = remote_user.create_remote_user(self.user_data)
|
|
||||||
self.assertFalse(user.local)
|
|
||||||
self.assertEqual(user.remote_id, 'https://example.com/user/mouse')
|
|
||||||
self.assertEqual(user.username, 'mouse@example.com')
|
|
||||||
self.assertEqual(user.name, 'MOUSE?? MOUSE!!')
|
|
||||||
self.assertEqual(user.inbox, 'https://example.com/user/mouse/inbox')
|
|
||||||
self.assertEqual(user.outbox, 'https://example.com/user/mouse/outbox')
|
|
||||||
self.assertEqual(user.shared_inbox, 'https://example.com/inbox')
|
|
||||||
self.assertEqual(
|
|
||||||
user.public_key,
|
|
||||||
self.user_data['publicKey']['publicKeyPem']
|
|
||||||
)
|
|
||||||
self.assertEqual(user.local, False)
|
|
||||||
self.assertEqual(user.bookwyrm_user, True)
|
|
||||||
self.assertEqual(user.manually_approves_followers, False)
|
|
||||||
|
|
||||||
|
|
||||||
def test_create_remote_user_missing_inbox(self):
|
|
||||||
del self.user_data['inbox']
|
|
||||||
self.assertRaises(
|
|
||||||
TypeError,
|
|
||||||
remote_user.create_remote_user,
|
|
||||||
self.user_data
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def test_create_remote_user_missing_outbox(self):
|
|
||||||
del self.user_data['outbox']
|
|
||||||
self.assertRaises(
|
|
||||||
TypeError,
|
|
||||||
remote_user.create_remote_user,
|
|
||||||
self.user_data
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def test_create_remote_user_default_fields(self):
|
|
||||||
del self.user_data['manuallyApprovesFollowers']
|
|
||||||
user = remote_user.create_remote_user(self.user_data)
|
|
||||||
self.assertEqual(user.manually_approves_followers, False)
|
|
||||||
|
|
Loading…
Reference in a new issue