(t *testing.T)
| 87 | } |
| 88 | |
| 89 | func TestListRun(t *testing.T) { |
| 90 | workflows := []shared.Workflow{ |
| 91 | { |
| 92 | Name: "Go", |
| 93 | State: shared.Active, |
| 94 | ID: 707, |
| 95 | }, |
| 96 | { |
| 97 | Name: "Linter", |
| 98 | State: shared.Active, |
| 99 | ID: 666, |
| 100 | }, |
| 101 | { |
| 102 | Name: "Release", |
| 103 | State: shared.DisabledManually, |
| 104 | ID: 451, |
| 105 | }, |
| 106 | } |
| 107 | payload := shared.WorkflowsPayload{Workflows: workflows} |
| 108 | |
| 109 | tests := []struct { |
| 110 | name string |
| 111 | opts *ListOptions |
| 112 | wantErr bool |
| 113 | wantOut string |
| 114 | wantErrOut string |
| 115 | stubs func(*httpmock.Registry) |
| 116 | tty bool |
| 117 | }{ |
| 118 | { |
| 119 | name: "lists worrkflows nontty", |
| 120 | opts: &ListOptions{ |
| 121 | Limit: defaultLimit, |
| 122 | }, |
| 123 | wantOut: "Go\tactive\t707\nLinter\tactive\t666\n", |
| 124 | }, |
| 125 | { |
| 126 | name: "lists workflows tty", |
| 127 | opts: &ListOptions{ |
| 128 | Limit: defaultLimit, |
| 129 | }, |
| 130 | tty: true, |
| 131 | wantOut: "NAME STATE ID\nGo active 707\nLinter active 666\n", |
| 132 | }, |
| 133 | { |
| 134 | name: "lists workflows with limit tty", |
| 135 | opts: &ListOptions{ |
| 136 | Limit: 1, |
| 137 | }, |
| 138 | tty: true, |
| 139 | wantOut: "NAME STATE ID\nGo active 707\n", |
| 140 | }, |
| 141 | { |
| 142 | name: "show all workflows tty", |
| 143 | opts: &ListOptions{ |
| 144 | Limit: defaultLimit, |
| 145 | All: true, |
| 146 | }, |
nothing calls this directly
no test coverage detected