Esempio n. 1
0
 def test_returns_none_on_fetch_document_exception(self, mock_retrieve, mock_fetch):
     mock_retrieve.return_value = DiasporaWebFinger(
         "bob@localhost", "https://localhost", "123", "456"
     ).xrd
     mock_fetch.return_value = None, None, ValueError()
     document = retrieve_diaspora_hcard("bob@localhost")
     mock_fetch.assert_called_with("https://localhost/hcard/users/123")
     assert document == None
Esempio n. 2
0
 def test_returns_none_on_fetch_document_exception(self, mock_retrieve, mock_fetch):
     mock_retrieve.return_value = DiasporaWebFinger(
         "bob@localhost", "https://localhost", "123", "456"
     ).xrd
     mock_fetch.return_value = None, None, ValueError()
     document = retrieve_diaspora_hcard("bob@localhost")
     mock_fetch.assert_called_with("https://localhost/hcard/users/123")
     assert document == None
Esempio n. 3
0
 def test_fetch_document_is_called(self, mock_retrieve, mock_fetch):
     mock_retrieve.return_value = DiasporaWebFinger(
         "bob@localhost", "https://localhost", "123", "456"
     ).xrd
     mock_fetch.return_value = "document", None, None
     document = retrieve_diaspora_hcard("bob@localhost")
     mock_fetch.assert_called_with("https://localhost/hcard/users/123")
     assert document == "document"
Esempio n. 4
0
 def test_fetch_document_is_called(self, mock_retrieve, mock_fetch):
     mock_retrieve.return_value = DiasporaWebFinger(
         "bob@localhost", "https://localhost", "123", "456"
     ).xrd
     mock_fetch.return_value = "document", None, None
     document = retrieve_diaspora_hcard("bob@localhost")
     mock_fetch.assert_called_with("https://localhost/hcard/users/123")
     assert document == "document"
Esempio n. 5
0
 def test_retrieve_webfinger_is_called(self, mock_retrieve):
     retrieve_diaspora_hcard("bob@localhost")
     assert mock_retrieve.called_with("bob@localhost")
Esempio n. 6
0
 def test_returns_none_on_fetch_document_exception(self, mock_retrieve,
                                                   mock_fetch):
     mock_fetch.return_value = None, None, ValueError()
     result = retrieve_diaspora_hcard("bob@localhost")
     mock_fetch.assert_called_with("http://localhost")
     assert result is None
Esempio n. 7
0
 def test_fetch_document_is_called(self, mock_retrieve, mock_fetch):
     mock_fetch.return_value = "document", None, None
     retrieve_diaspora_hcard("bob@localhost")
     mock_fetch.assert_called_with("http://localhost")
Esempio n. 8
0
 def test_retrieve_webfinger_is_called(self, mock_retrieve):
     retrieve_diaspora_hcard("bob@localhost")
     assert mock_retrieve.called_with("bob@localhost")