File: delete.feature

package info (click to toggle)
hub 2.14.2~ds1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, trixie
  • size: 1,376 kB
  • sloc: sh: 1,049; ruby: 857; makefile: 89
file content (95 lines) | stat: -rw-r--r-- 2,714 bytes parent folder | download | duplicates (3)
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
Feature: hub delete
  Background:
    Given I am "andreasbaumann" on github.com with OAuth token "OTOKEN"

  Scenario: No argument in current repo
    Given I am in "git://github.com/github/hub.git" git repo
    When I run `hub delete`
    Then the exit status should be 1
    And the stderr should contain exactly:
      """
      Usage: hub delete [-y] [<ORGANIZATION>/]<NAME>\n
      """

  Scenario: Successful confirmation
    Given the GitHub API server:
      """
      delete('/repos/andreasbaumann/my-repo') {
        status 204
      }
      """
    When I run `hub delete my-repo` interactively
    And I type "yes"
    Then the exit status should be 0
    And the output should contain:
      """
      Really delete repository 'andreasbaumann/my-repo' (yes/N)?
      """
    And the output should contain:
      """
      Deleted repository 'andreasbaumann/my-repo'.
      """

  Scenario: Org repo
    Given the GitHub API server:
      """
      delete('/repos/our-org/my-repo') {
        status 204
      }
      """
    When I run `hub delete our-org/my-repo` interactively
    And I type "yes"
    Then the exit status should be 0
    And the output should contain:
      """
      Really delete repository 'our-org/my-repo' (yes/N)?
      """
    And the output should contain:
      """
      Deleted repository 'our-org/my-repo'.
      """

  Scenario: Invalid confirmation
    When I run `hub delete my-repo` interactively
    And I type "y"
    Then the exit status should be 1
    And the output should contain:
      """
      Really delete repository 'andreasbaumann/my-repo' (yes/N)?
      """
    And the stderr should contain exactly:
      """
      Please type 'yes' for confirmation.\n
      """

  Scenario: HTTP 403
    Given the GitHub API server:
      """
      delete('/repos/andreasbaumann/my-repo') {
        status 403
      }
      """
    When I run `hub delete -y my-repo`
    Then the exit status should be 1
    And the stderr should contain:
      """
      Please edit the token used for hub at https://github.com/settings/tokens
      and verify that the `delete_repo` scope is enabled.
      """

  Scenario: HTTP 403 on GitHub Enterprise
    Given I am "mislav" on git.my.org with OAuth token "FITOKEN"
    And $GITHUB_HOST is "git.my.org"
    Given the GitHub API server:
      """
      delete('/api/v3/repos/mislav/my-repo', :host_name => 'git.my.org') {
        status 403
      }
      """
    When I run `hub delete -y my-repo`
    Then the exit status should be 1
    And the stderr should contain:
      """
      Please edit the token used for hub at https://git.my.org/settings/tokens
      and verify that the `delete_repo` scope is enabled.
      """