示例#1
0
文件: test_users.py 项目: alanoe/pulp
    def test_update_user(self, mock_ctrl, mock_model, mock_resp):
        """
        Test user update
        """
        request = mock.MagicMock()
        request.body = json.dumps({'delta': {'name': 'some-user'}})
        user = UserResourceView()
        response = user.put(request, 'test-user')

        mock_ctrl.update_user.assert_called_once_with('test-user', {'name': 'some-user'})
        mock_model.SERIALIZER.assert_called_once_with(mock_ctrl.update_user.return_value)
        mock_resp.assert_called_once_with(mock_model.SERIALIZER.return_value.data)
        self.assertTrue(response is mock_resp.return_value)
示例#2
0
    def test_update_user(self, mock_ctrl, mock_model, mock_resp):
        """
        Test user update
        """
        request = mock.MagicMock()
        request.body = json.dumps({'delta': {'name': 'some-user'}})
        user = UserResourceView()
        response = user.put(request, 'test-user')

        mock_ctrl.update_user.assert_called_once_with('test-user', {'name': 'some-user'})
        mock_model.serializer.assert_called_once_with(mock_ctrl.update_user.return_value)
        mock_resp.assert_called_once_with(mock_model.serializer.return_value.data)
        self.assertTrue(response is mock_resp.return_value)
示例#3
0
文件: test_users.py 项目: kaos/pulp
    def test_update_user(self, mock_factory, mock_resp):
        """
        Test user update
        """
        resp = {'login': '******', 'name': 'some-user', 'id': '12345'}
        mock_factory.user_manager.return_value.update_user.return_value = resp

        request = mock.MagicMock()
        request.body = json.dumps({'delta': {'name': 'some-user'}})
        user = UserResourceView()
        response = user.put(request, 'test-user')

        expected_cont = {'login': '******', 'name': 'some-user'}

        mock_resp.assert_called_once_with(expected_cont)
        self.assertTrue(response is mock_resp.return_value)
示例#4
0
    def test_update_user(self, mock_factory, mock_resp):
        """
        Test user update
        """
        resp = {'login': '******', 'name': 'some-user', 'id': '12345'}
        mock_factory.user_manager.return_value.update_user.return_value = resp

        request = mock.MagicMock()
        request.body = json.dumps({'delta': {'name': 'some-user'}})
        user = UserResourceView()
        response = user.put(request, 'test-user')

        expected_cont = {'login': '******', 'name': 'some-user'}

        mock_resp.assert_called_once_with(expected_cont)
        self.assertTrue(response is mock_resp.return_value)