kopia lustrzana https://gitlab.com/jaywink/federation
Rollback Matrix port removal from hostmeta results
Change requires full support for the server discovery flow.merge-requests/159/merge
rodzic
557146055c
commit
71ccfb9148
|
@ -125,9 +125,8 @@ def parse_mastodon_document(doc, host):
|
|||
|
||||
def parse_matrix_document(doc: Dict, host: str) -> Dict:
|
||||
result = deepcopy(defaults)
|
||||
host_without_port = host.split(':')[0]
|
||||
result['host'] = host_without_port
|
||||
result['name'] = host_without_port
|
||||
result['host'] = host
|
||||
result['name'] = host
|
||||
result['protocols'] = ['matrix']
|
||||
result['platform'] = f'matrix|{doc["server"]["name"].lower()}'
|
||||
result['version'] = doc["server"]["version"]
|
||||
|
|
|
@ -119,37 +119,6 @@ class TestParseMastodonDocument:
|
|||
|
||||
|
||||
class TestParseMatrixDocument:
|
||||
@patch('federation.hostmeta.parsers.send_document', autospec=True, return_value=(403, None))
|
||||
def test_parse_matrix_document__removes_port_from_host(self, mock_send):
|
||||
result = parse_matrix_document(json.loads(MATRIX_SYNAPSE_DOC), 'feneas.org:8448')
|
||||
assert result == {
|
||||
'organization': {
|
||||
'account': '',
|
||||
'contact': '',
|
||||
'name': '',
|
||||
},
|
||||
'host': 'feneas.org',
|
||||
'name': 'feneas.org',
|
||||
'open_signups': False,
|
||||
'protocols': ['matrix'],
|
||||
'relay': '',
|
||||
'server_meta': {},
|
||||
'services': [],
|
||||
'platform': 'matrix|synapse',
|
||||
'version': '0.33.8',
|
||||
'features': {},
|
||||
'activity': {
|
||||
'users': {
|
||||
'total': None,
|
||||
'half_year': None,
|
||||
'monthly': None,
|
||||
'weekly': None,
|
||||
},
|
||||
'local_posts': None,
|
||||
'local_comments': None,
|
||||
},
|
||||
}
|
||||
|
||||
@patch('federation.hostmeta.parsers.send_document', autospec=True, return_value=(403, None))
|
||||
def test_parse_matrix_document__signups_closed(self, mock_send):
|
||||
result = parse_matrix_document(json.loads(MATRIX_SYNAPSE_DOC), 'feneas.org')
|
||||
|
|
Ładowanie…
Reference in New Issue