64 changed files with 4572 additions and 241 deletions
@ -0,0 +1,36 @@
|
||||
--- |
||||
date: "2019-03-11T21:45:00+00:00" |
||||
title: "高级: 第三方工具" |
||||
slug: "third-party-tools" |
||||
weight: 50 |
||||
toc: true |
||||
draft: false |
||||
menu: |
||||
sidebar: |
||||
parent: "advanced" |
||||
name: "第三方工具" |
||||
weight: 50 |
||||
identifier: "third-party-tools" |
||||
--- |
||||
|
||||
# 第三方工具列表 |
||||
**注意:** 这些工具并没有经过Gitea的检验,在这里列出它们只是为了便捷. |
||||
|
||||
*此列表并不是完整的列表,可以随时咨询如何添加!* |
||||
|
||||
### 持续集成 |
||||
[BuildKite 连接器](https://github.com/techknowlogick/gitea-buildkite-connector) |
||||
[Jenkins 插件](https://github.com/jenkinsci/gitea-plugin) |
||||
[Gitea搭配Drone](https://docs.drone.io/installation/gitea) |
||||
|
||||
|
||||
### 迁移 |
||||
[Gitea安装脚本](https://git.coolaj86.com/coolaj86/gitea-installer.sh) |
||||
[GitHub迁移](https://gitea.com/gitea/migrator) |
||||
|
||||
|
||||
### 移动端 |
||||
[安卓客户端GitNex](https://gitlab.com/mmarif4u/gitnex) |
||||
|
||||
### 编辑器扩展 |
||||
- [Gitea的Visual Studio扩展](https://github.com/maikebing/Gitea.VisualStudio) 从 [Visual Studio 扩展市场](https://marketplace.visualstudio.com/items?itemName=MysticBoy.GiteaExtensionforVisualStudio) 下载 |
@ -0,0 +1,47 @@
|
||||
// Copyright 2019 The Gitea Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package action |
||||
|
||||
import ( |
||||
"path/filepath" |
||||
"strings" |
||||
"testing" |
||||
|
||||
"code.gitea.io/gitea/models" |
||||
"github.com/stretchr/testify/assert" |
||||
) |
||||
|
||||
func TestMain(m *testing.M) { |
||||
models.MainTest(m, filepath.Join("..", "..", "..")) |
||||
} |
||||
|
||||
func TestRenameRepoAction(t *testing.T) { |
||||
assert.NoError(t, models.PrepareTestDatabase()) |
||||
|
||||
user := models.AssertExistsAndLoadBean(t, &models.User{ID: 2}).(*models.User) |
||||
repo := models.AssertExistsAndLoadBean(t, &models.Repository{OwnerID: user.ID}).(*models.Repository) |
||||
repo.Owner = user |
||||
|
||||
oldRepoName := repo.Name |
||||
const newRepoName = "newRepoName" |
||||
repo.Name = newRepoName |
||||
repo.LowerName = strings.ToLower(newRepoName) |
||||
|
||||
actionBean := &models.Action{ |
||||
OpType: models.ActionRenameRepo, |
||||
ActUserID: user.ID, |
||||
ActUser: user, |
||||
RepoID: repo.ID, |
||||
Repo: repo, |
||||
IsPrivate: repo.IsPrivate, |
||||
Content: oldRepoName, |
||||
} |
||||
models.AssertNotExistsBean(t, actionBean) |
||||
|
||||
NewNotifier().NotifyRenameRepository(user, repo, oldRepoName) |
||||
|
||||
models.AssertExistsAndLoadBean(t, actionBean) |
||||
models.CheckConsistencyFor(t, &models.Action{}) |
||||
} |
@ -0,0 +1,39 @@
|
||||
// Copyright 2019 The Gitea Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package webhook |
||||
|
||||
import ( |
||||
"net/http" |
||||
"net/url" |
||||
"testing" |
||||
|
||||
"code.gitea.io/gitea/modules/setting" |
||||
"github.com/stretchr/testify/assert" |
||||
) |
||||
|
||||
func TestWebhookProxy(t *testing.T) { |
||||
setting.Webhook.ProxyURL = "http://localhost:8080" |
||||
setting.Webhook.ProxyURLFixed, _ = url.Parse(setting.Webhook.ProxyURL) |
||||
setting.Webhook.ProxyHosts = []string{"*.discordapp.com", "discordapp.com"} |
||||
|
||||
var kases = map[string]string{ |
||||
"https://discordapp.com/api/webhooks/xxxxxxxxx/xxxxxxxxxxxxxxxxxxx": "http://localhost:8080", |
||||
"http://s.discordapp.com/assets/xxxxxx": "http://localhost:8080", |
||||
"http://github.com/a/b": "", |
||||
} |
||||
|
||||
for reqURL, proxyURL := range kases { |
||||
req, err := http.NewRequest("POST", reqURL, nil) |
||||
assert.NoError(t, err) |
||||
|
||||
u, err := webhookProxy()(req) |
||||
assert.NoError(t, err) |
||||
if proxyURL == "" { |
||||
assert.Nil(t, u) |
||||
} else { |
||||
assert.EqualValues(t, proxyURL, u.String()) |
||||
} |
||||
} |
||||
} |
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue