summaryrefslogtreecommitdiff
path: root/testing/02-commands-rename.yarn
blob: cd9b7028f3b9ddcbf20d6d093612e649cd0c8e66 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<!-- -*- markdown -*- -->

Renaming repositories
=====================

Sometimes a repository doesn't have the correct name.  Since in Gitano, the
repository name is merely a side-effect of its location on the filesystem
(though that may play into rules in some cases) renaming a repository is
a fairly simple operation to perform.

    SCENARIO rename repository

    GIVEN a standard instance
     WHEN testinstance adminkey runs copy gitano-admin public/testrepo
     THEN server-side public/testrepo has identical refs to gitano-admin

When a repository is renamed it does not modify any of the refs.

    WHEN testinstance adminkey runs rename public/testrepo public/testrepo2
    THEN server-side public/testrepo2 has identical refs to gitano-admin

    FINALLY the instance is torn down

Permissions for renaming
========================

A user must have read access, rename access for the existing repository, and
must have create access for the destination name.

    SCENARIO rename permissions

    GIVEN a standard instance
      AND testinstance using adminkey has patched gitano-admin with personal-repo-create.patch
      AND testinstance, using adminkey, adds a new user alice, with a key called main

    WHEN alice main runs create personal/alice/testrepo
    WHEN alice main runs create personal/alice/testrepo2
     AND alice main runs ls
    THEN stdout contains personal/alice/testrepo
     AND stdout contains personal/alice/testrepo2

    WHEN alice main, expecting failure, runs rename personal/alice/testrepo personal/alice/testrepo2
    THEN stderr contains CRIT: Destination location is in use

    WHEN alice main, expecting failure, runs rename personal/alice/testrepo3 personal/alice/testrepo4
    THEN stderr contains CRIT: Cannot rename a repository which does not exist

If a user is not permitted to see a repository they can't rename it,
and it does not reveal the existence of the repository.

    WHEN alice main, expecting failure, runs rename personal/alice/testrepo gitano-admin
    THEN stderr contains CRIT: Ruleset denied action.
     AND stderr does not contain CRIT: Destination location is in use

    WHEN alice main, expecting failure, runs rename testrepo personal/alice/gitano-admin
    THEN stderr contains CRIT: The ruleset didn't provide access.
     AND stderr does not contain ERROR: Cannot rename testrepo as it does not exist

    FINALLY the instance is torn down