Skip to content

Commit

Permalink
test_redirect: minor noop test data refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
snarfed committed May 24, 2023
1 parent af95521 commit 30659a7
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions tests/test_redirect.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
)
from . import testutil

REPOST_AS2 = copy.deepcopy(REPOST_AS2)
REPOST_AS2 = {
**REPOST_AS2,
'actor': ACTOR_AS2,
}
del REPOST_AS2['cc']

EXTERNAL_REPOST_AS2 = copy.deepcopy(REPOST_AS2)
EXTERNAL_REPOST_AS2['actor'] = {
**ACTOR_AS2,
'id': 'http://localhost/r/https://user.com/',
}
EXTERNAL_REPOST_AS2['actor']['id'] = 'http://localhost/r/https://user.com/'


class RedirectTest(testutil.TestCase):
Expand Down Expand Up @@ -85,10 +85,7 @@ def test_as2_fetch_post(self, mock_get):
resp = self.client.get('/r/https://user.com/repost',
headers={'Accept': as2.CONTENT_TYPE})
self.assertEqual(200, resp.status_code, resp.get_data(as_text=True))
self.assert_equals({
**REPOST_AS2,
'actor': ACTOR_AS2,
}, resp.json)
self.assert_equals(REPOST_AS2, resp.json)

@patch('requests.get')
def test_as2_fetch_post_no_backlink(self, mock_get):
Expand All @@ -98,10 +95,7 @@ def test_as2_fetch_post_no_backlink(self, mock_get):
resp = self.client.get('/r/https://user.com/repost',
headers={'Accept': as2.CONTENT_TYPE})
self.assertEqual(200, resp.status_code, resp.get_data(as_text=True))
self.assert_equals({
**REPOST_AS2,
'actor': ACTOR_AS2,
}, resp.json)
self.assert_equals(REPOST_AS2, resp.json)

@patch('requests.get')
def test_as2_no_user_fetch_homepage(self, mock_get):
Expand Down

0 comments on commit 30659a7

Please sign in to comment.