storj-archived / storj-python-sdk

Deprecated. A Python SDK for the Storj API.
https://storj.io
MIT License
23 stars 19 forks source link

ClientTestCase.test_user_create #84

Closed steenzout closed 7 years ago

steenzout commented 7 years ago
______________________________________________________________ ClientTestCase.test_user_create _______________________________________________________________
[gw0] darwin -- Python 3.6.0 /Users/steenzout/Projects/github/steenzout/python/storj/.tox/py36/bin/python3.6
self = <tests.unit.http_test.ClientTestCase testMethod=test_user_create>
mock_sha256 = <MagicMock name='sha256' id='4408722152'>
mock_authenticate = <MagicMock name='authenticate' id='4409987928'>

    @mock.patch.object(http.Client, 'authenticate', return_value=None)
    @mock.patch('storj.http.sha256')
    def test_user_create(self, mock_sha256, mock_authenticate):
        """Test Client.user_create()."""
        test_email = 'a@b.com'
        test_password = 'toast'
        test_hashed_password = 'hashed password'

        mock_sha256.return_value.hexdigest.return_value = test_hashed_password

        self.client.user_create(test_email, test_password)

        mock_sha256.assert_called_once_with(test_password)
        mock_sha256.return_value.hexdigest.assert_called_once_with()

        mock_authenticate.assert_called_once_with(
            email=test_email,
>           password=test_hashed_password)

tests/unit/http_test.py:611: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

_mock_self = <MagicMock name='authenticate' id='4409987928'>, args = ()
kwargs = {'email': 'a@b.com', 'password': 'hashed password'}
self = <MagicMock name='authenticate' id='4409987928'>
msg = "Expected 'authenticate' to be called once. Called 0 times."

    def assert_called_once_with(_mock_self, *args, **kwargs):
        """assert that the mock was called exactly once and with the specified
            arguments."""
        self = _mock_self
        if not self.call_count == 1:
            msg = ("Expected '%s' to be called once. Called %s times." %
                   (self._mock_name or 'mock', self.call_count))
>           raise AssertionError(msg)
E           AssertionError: Expected 'authenticate' to be called once. Called 0 times.

.tox/py36/lib/python3.6/site-packages/mock/mock.py:947: AssertionError
steenzout commented 7 years ago

please assign this to me.