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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
use crate::framework::response::ApiResult;
pub mod delete;
pub mod get;
pub mod patch;
pub mod post;
pub mod put;
pub use get::{TestCaseList, TestNodeList, TestRunDetails, TestRunDetailsByPipeline, TestRunList};
pub use patch::{TestRunUpdate, TestRunUpdateParams};
pub use post::{TestRunCreate, TestRunCreateParams};
impl ApiResult for TestCase {}
impl ApiResult for Vec<TestCase> {}
impl ApiResult for TestNode {}
impl ApiResult for Vec<TestNode> {}
impl ApiResult for TestRun {}
impl ApiResult for Vec<TestRun> {}
pub use test_case::TestCase;
pub use test_node::TestNode;
pub use test_run::TestRun;
mod test_case {
use chrono::offset::Utc;
use chrono::DateTime;
/// Test Case
///
/// Stability: prototype
///
/// A single test case belonging to a test run
///
/// [See Heroku documentation for more information about this endpoint](https://devcenter.heroku.com/articles/platform-api-reference#test-case)
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct TestCase {
/// unique identifier of a test case
pub id: String,
/// when test case was created
pub created_at: DateTime<Utc>,
/// when test case was updated
pub updated_at: DateTime<Utc>,
/// description of the test case
pub description: String,
/// meta information about the test case
pub diagnostic: String,
/// special note about the test case e.g. skipped, todo
pub directive: String,
/// whether the test case was successful
pub passed: bool,
/// the test number
pub number: i64,
/// Test node
pub test_node: TestNode,
/// Test run
pub test_run: TestRun,
}
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct TestNode {
/// unique identifier of a test node
pub id: String,
}
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct TestRun {
/// unique identifier of a test run
pub id: String,
}
}
mod test_node {
use chrono::offset::Utc;
use chrono::DateTime;
/// Test Node
///
/// Stability: prototype
///
/// A single test node belonging to a test run
///
/// [See Heroku documentation for more information about this endpoint](https://devcenter.heroku.com/articles/platform-api-reference#test-node)
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct TestNode {
/// when test node was created
pub created_at: DateTime<Utc>,
/// the dyno which belongs to this test node
pub dyno: Option<Dyno>,
/// the status of the test run when the error occured
pub error_status: Option<String>,
/// the exit code of the test script
pub exit_code: Option<i64>,
/// unique identifier of a test node
pub id: String,
/// the index of the test node
pub index: i64,
/// human friendly message indicating reason for an error
pub message: Option<String>,
/// the streaming output for the test node
pub output_stream_url: String,
/// pipeline
pub pipeline: Pipeline,
/// the streaming test setup output for the test node
pub setup_stream_url: String,
/// current state of the test run
/// one of:"pending" or "cancelled" or "creating" or "building" or "running" or "succeeded" or "failed" or "errored" or "debugging"
pub status: String,
/// when test node was updated
pub updated_at: DateTime<Utc>,
/// test run
pub test_run: TestRun,
}
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct Dyno {
/// unique identifier or the name of this process on this dyno
pub id: String,
/// a URL to stream output from for debug runs or null for non-debug runs
pub attach_url: Option<String>,
}
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct Pipeline {
/// unique identifier or name of pipeline
pub id: String,
}
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct TestRun {
/// unique identifier of a test run
pub id: String,
}
}
mod test_run {
use chrono::offset::Utc;
use chrono::DateTime;
use serde_json::Value;
/// Test Run
///
/// Stability: prototype
///
/// An execution or trial of one or more tests
///
/// [See Heroku documentation for more information about this endpoint](https://devcenter.heroku.com/articles/platform-api-reference#test-run)
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct TestRun {
/// the email of the actor triggering the test run
pub actor_email: String,
/// whether the test was run with an empty cache
pub clear_cache: Option<bool>,
/// the branch of the repository that the test run concerns
pub commit_branch: String,
/// the message for the commit under test
pub commit_message: String,
/// the SHA hash of the commit under test
pub commit_sha: String,
/// whether the test run was started for interactive debugging
pub debug: bool,
/// the app setup for the test run
pub app_setup: Option<Value>, //TODO update this
/// when test run was created
pub created_at: DateTime<Utc>,
/// the type of dynos used for this test-run
pub dyno: Option<Dyno>,
/// unique identifier of a test run
pub id: String,
/// human friendly message indicating reason for an error
pub message: Option<String>,
/// the auto incrementing test run number
pub number: i64,
/// the team that owns this test-run
pub organization: Option<Organization>,
/// pipeline
pub pipeline: Pipeline,
/// current state of the test run
/// one of:"pending" or "cancelled" or "creating" or "building" or "running" or "succeeded" or "failed" or "errored" or "debugging"
pub status: String,
/// The download location for the source code to be tested
pub source_blob_url: String,
/// when test-run was updated
pub updated_at: DateTime<Utc>,
/// user
pub user: User,
/// human friently warning emitted during the test run
pub warning_message: Option<String>,
}
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct Dyno {
/// dyno size (default: “standard-1X”)
pub size: String,
}
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct Organization {
/// unique name of team
pub name: String,
}
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct Pipeline {
/// unique identifier or name of pipeline
pub id: String,
}
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct User {
/// whether to allow third party web activity tracking
/// default: true
pub allow_tracking: Option<bool>,
/// whether allowed to utilize beta Heroku features
pub beta: Option<bool>,
/// when account was created
pub created_at: Option<DateTime<Utc>>,
/// unique email address
pub email: Option<String>,
/// whether the user is federated and belongs to an Identity Provider
pub federated: Option<bool>,
/// identifier of an account
pub id: String,
/// Identity Provider details for federated users.
pub identity_provider: Option<IdentityProvider>,
/// when account last authorized with Heroku
pub last_login: Option<DateTime<Utc>>,
/// full name of the account owner
pub name: Option<String>,
/// SMS number of account
pub sms_number: Option<String>,
/// when account was suspended
pub suspended_at: Option<String>,
/// when account became delinquent
pub delinquent_at: Option<DateTime<Utc>>,
/// whether two-factor auth is enabled on the account
pub two_factor_authentication: Option<bool>,
/// when account was updated
pub updated_at: Option<DateTime<Utc>>,
/// whether account has been verified with billing information
pub verified: Option<bool>,
/// team selected by default
pub default_organization: Option<DefaultOrganization>,
/// team selected by default
pub default_team: Option<DefaultTeam>,
}
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct IdentityProvider {
/// unique identifier of this identity provider
pub id: String,
/// identity provider team
pub team: Team,
/// identity provider organization
pub organization: Organization,
/// identity provider owner
pub owner: Owner,
}
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct Team {
/// unique name of team
pub name: String,
}
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct Owner {
/// unique identifier of the owner
pub id: String,
/// name of the owner
pub name: String,
/// type of the owner
/// one of:"team" or "enterprise-account"
#[serde(rename = "type")]
pub type_field: String,
}
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct DefaultOrganization {
/// unique identifier of team
pub id: String,
/// unique name of team
pub name: String,
}
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct DefaultTeam {
/// unique identifier of team
pub id: String,
/// unique name of team
pub name: String,
}
}