Пример #1
0
 def test_returns_none_on_xrd_parse_exception(self, mock_parse, mock_retrieve, mock_fetch):
     mock_retrieve.return_value = DiasporaHostMeta(
         webfinger_host="https://localhost"
     ).xrd
     document = retrieve_diaspora_webfinger("bob@localhost")
     mock_parse.assert_called_once_with("document")
     assert document == None
Пример #2
0
 def test_returns_none_on_fetch_document_exception(self, mock_retrieve, mock_fetch):
     mock_retrieve.return_value = DiasporaHostMeta(
         webfinger_host="https://localhost"
     ).xrd
     mock_fetch.return_value = None, None, ValueError()
     document = retrieve_diaspora_webfinger("bob@localhost")
     mock_fetch.assert_called_with("https://localhost/webfinger?q=%s" % quote("bob@localhost"))
     assert document == None
Пример #3
0
 def test_returns_none_on_fetch_document_exception(self, mock_retrieve, mock_fetch):
     mock_retrieve.return_value = DiasporaHostMeta(
         webfinger_host="https://localhost"
     ).xrd
     mock_fetch.return_value = None, None, ValueError()
     document = retrieve_diaspora_webfinger("bob@localhost")
     mock_fetch.assert_called_with("https://localhost/webfinger?q=%s" % quote("bob@localhost"))
     assert document == None
Пример #4
0
 def test_retrieve_fetch_document_is_called(self, mock_retrieve, mock_fetch, mock_xrd):
     mock_retrieve.return_value = DiasporaHostMeta(
         webfinger_host="https://localhost"
     ).xrd
     mock_fetch.return_value = "document", None, None
     mock_xrd.return_value = "document"
     document = retrieve_diaspora_webfinger("bob@localhost")
     mock_fetch.assert_called_with("https://localhost/webfinger?q=%s" % quote("bob@localhost"))
     assert document == "document"
Пример #5
0
 def test_retrieve_fetch_document_is_called(self, mock_retrieve, mock_fetch, mock_xrd):
     mock_retrieve.return_value = DiasporaHostMeta(
         webfinger_host="https://localhost"
     ).xrd
     mock_fetch.return_value = "document", None, None
     mock_xrd.return_value = "document"
     document = retrieve_diaspora_webfinger("bob@localhost")
     mock_fetch.assert_called_with("https://localhost/webfinger?q=%s" % quote("bob@localhost"))
     assert document == "document"
Пример #6
0
 def test_retrieve_host_meta_is_called(self, mock_retrieve):
     retrieve_diaspora_webfinger("bob@localhost")
     mock_retrieve.assert_called_with("localhost")
Пример #7
0
 def test_retrieve_host_meta_is_called(self, mock_retrieve):
     retrieve_diaspora_webfinger("bob@localhost")
     mock_retrieve.assert_called_with("localhost")