【问题标题】:Karate software - uploading files to Gitlab via Karate (permission problem) [duplicate]空手道软件-通过空手道将文件上传到Gitlab(权限问题)[重复]
【发布时间】:2020-09-24 13:56:14
【问题描述】:

使用空手道我需要将一些文件上传到 Gitlab,但我没有成功。我不知道如何处理能够连接到 Git 实验室的凭据。我试过用这个:

Given url 'https://gitlab.xxxx.xxxxx.com/projectX/client-data-service'
And multipart file file = { read: 'test.jpg', filename:'test.jpg', contentType: 'image/jpg' }
When method post
Then status 200

然后我一开始就尝试使用通过驱动程序登录到gitlab(要登录):

Given driver 'https://gitlab.xxxx.xxxxx.com/users/sign_in'
* retry().input('input[id=user_login]', 'user@user.xx')
* retry().input('input[id=user_password]', '12345')
* retry().click('input[name=commit]')
* delay(3000);
Given driver 'https://gitlab.xxxx.xxxxx.com/projectX/client-data-service'
* delay(3000);

Given url 'https://gitlab.xxxx.xxxxx.com/projectX/client-data-service'
And multipart file file = { read: 'test.jpg', filename:'test.jpg', contentType: 'image/jpg' }
When method post
Then status 200

但我仍然收到有关权限问题的信息:

<div class="container">
    <h3>The page could not be found or you don't have permission to view it.</h3>
    <hr />
    <p>The resource that you are attempting to access does not exist or you don't have the necessary permissions to view it.</p>
    <p>Make sure the address is correct and that the page hasn't moved.</p>
    <p>Please contact your GitLab administrator if you think this is a mistake.</p>
    <a href="javascript:history.back()" class="js-go-back go-back">Go back</a>
  </div>

您是否有一些想法可以成功地将文件上传到 Gitlab/Github 并获得许可?谢谢!

【问题讨论】:

    标签: automated-tests karate


    【解决方案1】:

    我建议使用 API。您必须通过阅读此处的文档来了解如何传递 GitLab 凭据:https://docs.gitlab.com/ee/api/README.html#authentication

    很抱歉,我无能为力。请注意,演示中有 auth 甚至 OAuth 的示例。也许您只需要添加带有私有/访问令牌的标头。尝试先让 cURL 命令工作,然后将其移植到空手道应该很容易。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多