コード例 #1
0
    def test_change_current_editor(self):
        body = {
            'self': self.ds_url,
            'name': 'Dataset Name'
        }
        sess = mock.MagicMock()
        ds = Dataset(session=sess, body=body)
        ds.patch = mock.MagicMock()
        ds.change_current_editor(self.user_url)

        ds.patch.assert_called_with({
            'current_editor': self.user_url
        })
コード例 #2
0
    def test_change_current_editor_email(self):
        sess = mock.MagicMock()
        response = mock.MagicMock()
        response.payload = {
            'index': {
                self.user_url: {
                    'email': '*****@*****.**'
                }
            }
        }

        def _get(*args, **kwargs):
            return response

        sess.get.side_effect = _get
        ds = Dataset(session=sess)
        ds.self = self.ds_url
        ds.patch = mock.MagicMock()
        ds.change_current_editor('*****@*****.**')

        ds.patch.assert_called_with({
            'current_editor': self.user_url
        })