summaryrefslogtreecommitdiffstats
path: root/integrations/ssh_key_test.go
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2020-04-28 09:32:23 +0100
committerGitHub <noreply@github.com>2020-04-28 09:32:23 +0100
commit1f0b797ddc139c3241c9b9694f0666a28ab41d80 (patch)
treedc2341417062baf75e21bf48b91b3169b47a1a28 /integrations/ssh_key_test.go
parentb0849abf3d9b25d06ab8099c62409d87d9a0ca86 (diff)
downloadgitea-1f0b797ddc139c3241c9b9694f0666a28ab41d80.tar.gz
gitea-1f0b797ddc139c3241c9b9694f0666a28ab41d80.zip
Make the PushCreate test declarative (#11229)
Reduce the code duplication in the PushCreate test and switch to a declarative format. * Instead of explicitly creating the repository re-use functions from the other declarative tests and add comments * Ensure that the test repository is deleted at the end of test * Slightly reorder the sub-tests Also reduce the code duplication in MergeFork and add some comments there too and make doGitCloneFail be self-contained. Signed-off-by: Andrew Thornton art27@cantab.net
Diffstat (limited to 'integrations/ssh_key_test.go')
-rw-r--r--integrations/ssh_key_test.go10
1 files changed, 3 insertions, 7 deletions
diff --git a/integrations/ssh_key_test.go b/integrations/ssh_key_test.go
index 944d2f6bed..d445c7f9e5 100644
--- a/integrations/ssh_key_test.go
+++ b/integrations/ssh_key_test.go
@@ -113,7 +113,7 @@ func testKeyOnlyOneType(t *testing.T, u *url.URL) {
sshURL := createSSHUrl(ctx.GitPath(), u)
- t.Run("FailToClone", doGitCloneFail(dstPath, sshURL))
+ t.Run("FailToClone", doGitCloneFail(sshURL))
t.Run("CreateUserKey", doAPICreateUserKey(ctx, keyname, keyFile, func(t *testing.T, publicKey api.PublicKey) {
userKeyPublicKeyID = publicKey.ID
@@ -139,7 +139,7 @@ func testKeyOnlyOneType(t *testing.T, u *url.URL) {
sshURL := createSSHUrl(ctx.GitPath(), u)
- t.Run("FailToClone", doGitCloneFail(dstPath, sshURL))
+ t.Run("FailToClone", doGitCloneFail(sshURL))
// Should now be able to add...
t.Run("AddReadOnlyDeployKey", doAPICreateDeployKey(ctx, keyname, keyFile, true))
@@ -204,15 +204,11 @@ func testKeyOnlyOneType(t *testing.T, u *url.URL) {
})
t.Run("DeleteUserKeyShouldRemoveAbilityToClone", func(t *testing.T) {
- dstPath, err := ioutil.TempDir("", ctx.Reponame)
- assert.NoError(t, err)
- defer os.RemoveAll(dstPath)
-
sshURL := createSSHUrl(ctx.GitPath(), u)
t.Run("DeleteUserKey", doAPIDeleteUserKey(ctx, userKeyPublicKeyID))
- t.Run("FailToClone", doGitCloneFail(dstPath, sshURL))
+ t.Run("FailToClone", doGitCloneFail(sshURL))
})
})
}