File tree Expand file tree Collapse file tree 1 file changed +28
-1
lines changed
crates/crates_io_database/src/models/trustpub Expand file tree Collapse file tree 1 file changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,15 @@ pub enum TrustpubData {
19
19
/// SHA of the commit
20
20
sha : String ,
21
21
} ,
22
+ #[ serde( rename = "gitlab" ) ]
23
+ GitLab {
24
+ /// Project path (e.g. "rust-lang/cargo")
25
+ project_path : String ,
26
+ /// Job ID
27
+ job_id : String ,
28
+ /// SHA of the commit
29
+ sha : String ,
30
+ } ,
22
31
}
23
32
24
33
impl ToSql < Jsonb , Pg > for TrustpubData {
@@ -41,7 +50,7 @@ mod tests {
41
50
use insta:: assert_json_snapshot;
42
51
43
52
#[ test]
44
- fn test_serialization ( ) {
53
+ fn test_github_serialization ( ) {
45
54
let data = TrustpubData :: GitHub {
46
55
repository : "octo-org/octo-repo" . to_string ( ) ,
47
56
run_id : "example-run-id" . to_string ( ) ,
@@ -57,4 +66,22 @@ mod tests {
57
66
}
58
67
"# ) ;
59
68
}
69
+
70
+ #[ test]
71
+ fn test_gitlab_serialization ( ) {
72
+ let data = TrustpubData :: GitLab {
73
+ project_path : "rust-lang/cargo" . to_string ( ) ,
74
+ job_id : "example-job-id" . to_string ( ) ,
75
+ sha : "example-sha" . to_string ( ) ,
76
+ } ;
77
+
78
+ assert_json_snapshot ! ( data, @r#"
79
+ {
80
+ "provider": "gitlab",
81
+ "project_path": "rust-lang/cargo",
82
+ "job_id": "example-job-id",
83
+ "sha": "example-sha"
84
+ }
85
+ "# ) ;
86
+ }
60
87
}
You can’t perform that action at this time.
0 commit comments