aboutsummaryrefslogtreecommitdiffstats
path: root/rust/tests
diff options
context:
space:
mode:
Diffstat (limited to 'rust/tests')
-rw-r--r--rust/tests/test_api_server_http.rs53
-rw-r--r--rust/tests/test_old_python_tests.rs8
2 files changed, 47 insertions, 14 deletions
diff --git a/rust/tests/test_api_server_http.rs b/rust/tests/test_api_server_http.rs
index 6df616a6..0aa6b062 100644
--- a/rust/tests/test_api_server_http.rs
+++ b/rust/tests/test_api_server_http.rs
@@ -385,7 +385,7 @@ fn test_post_release() {
headers.clone(),
// TODO: target_release_id
r#"{"title": "secret minimal paper",
- "release_type": "journal-article",
+ "release_type": "article-journal",
"work_id": "aaaaaaaaaaaaavkvaaaaaaaaae"
}"#,
&router,
@@ -401,7 +401,7 @@ fn test_post_release() {
headers.clone(),
// TODO: target_release_id
r#"{"title": "secret minimal paper the second",
- "release_type": "journal-article"
+ "release_type": "article-journal"
}"#,
&router,
),
@@ -412,10 +412,10 @@ fn test_post_release() {
check_http_response(
request::post(
"http://localhost:9411/v0/release",
- headers,
+ headers.clone(),
// TODO: target_release_id
r#"{"title": "secret paper",
- "release_type": "journal-article",
+ "release_type": "article-journal",
"release_date": "2000-01-02",
"doi": "10.1234/abcde.781231231239",
"pmid": "54321",
@@ -437,7 +437,7 @@ fn test_post_release() {
"index": 1,
"raw_name": "textual description of contributor (aka, name)",
"creator_id": "aaaaaaaaaaaaaircaaaaaaaaae",
- "contrib_type": "author"
+ "role": "author"
},{
"raw_name": "shorter"
}],
@@ -683,7 +683,7 @@ fn test_400() {
"http://localhost:9411/v0/release",
headers,
r#"{"title": "secret paper",
- "release_type": "journal-article",
+ "release_type": "article-journal",
"doi": "10.1234/abcde.781231231239",
"volume": "439",
"issue": "IV",
@@ -1036,7 +1036,7 @@ fn test_release_dates() {
"http://localhost:9411/v0/release",
headers.clone(),
r#"{"title": "secret minimal paper",
- "release_type": "journal-article",
+ "release_type": "article-journal",
"release_date": "2000-01-02"
}"#,
&router,
@@ -1051,7 +1051,7 @@ fn test_release_dates() {
"http://localhost:9411/v0/release",
headers.clone(),
r#"{"title": "secret minimal paper",
- "release_type": "journal-article",
+ "release_type": "article-journal",
"release_date": "2000-01"
}"#,
&router,
@@ -1066,7 +1066,7 @@ fn test_release_dates() {
"http://localhost:9411/v0/release",
headers.clone(),
r#"{"title": "secret minimal paper",
- "release_type": "journal-article",
+ "release_type": "article-journal",
"release_date": "2005-08-30T00:00:00Z"
}"#,
&router,
@@ -1081,7 +1081,7 @@ fn test_release_dates() {
"http://localhost:9411/v0/release",
headers.clone(),
r#"{"title": "secret minimal paper",
- "release_type": "journal-article",
+ "release_type": "article-journal",
"release_date": "2000-88-99"
}"#,
&router,
@@ -1090,3 +1090,36 @@ fn test_release_dates() {
None,
);
}
+
+#[test]
+fn test_release_types() {
+ let (headers, router, _conn) = setup_http();
+
+ // Ok
+ check_http_response(
+ request::post(
+ "http://localhost:9411/v0/release",
+ headers.clone(),
+ r#"{"title": "secret minimal paper",
+ "release_type": "article-journal"
+ }"#,
+ &router,
+ ),
+ status::Created,
+ None,
+ );
+
+ // Bad
+ check_http_response(
+ request::post(
+ "http://localhost:9411/v0/release",
+ headers.clone(),
+ r#"{"title": "secret minimal paper",
+ "release_type": "journal-article"
+ }"#,
+ &router,
+ ),
+ status::BadRequest,
+ Some("release_type"),
+ );
+}
diff --git a/rust/tests/test_old_python_tests.rs b/rust/tests/test_old_python_tests.rs
index ebe1dd0b..1b496328 100644
--- a/rust/tests/test_old_python_tests.rs
+++ b/rust/tests/test_old_python_tests.rs
@@ -68,7 +68,7 @@ fn test_api_rich_create() {
// this stub work will be referenced
let mut new_release = ReleaseEntity::new("derivative work".to_string());
- new_release.release_type = Some("journal-article".to_string());
+ new_release.release_type = Some("article-journal".to_string());
new_release.work_id = Some(work_id.clone());
let mut contrib = ReleaseContrib::new();
contrib.creator_id = Some(creator_id.clone());
@@ -209,7 +209,7 @@ fn test_merge_works() {
_ => unreachable!(),
};
let mut new_release = ReleaseEntity::new("some release".to_string());
- new_release.release_type = Some("journal-article".to_string());
+ new_release.release_type = Some("article-journal".to_string());
new_release.work_id = Some(work_a_id.clone());
new_release.doi = Some("10.1234/A1".to_string());
let resp = client
@@ -231,7 +231,7 @@ fn test_merge_works() {
};
let mut new_release = ReleaseEntity::new("some release".to_string());
- new_release.release_type = Some("journal-article".to_string());
+ new_release.release_type = Some("article-journal".to_string());
new_release.work_id = Some(work_b_id.clone());
new_release.doi = Some("10.1234/B1".to_string());
let resp = client
@@ -244,7 +244,7 @@ fn test_merge_works() {
};
let mut new_release = ReleaseEntity::new("some release".to_string());
- new_release.release_type = Some("journal-article".to_string());
+ new_release.release_type = Some("article-journal".to_string());
new_release.work_id = Some(work_b_id.clone());
new_release.doi = Some("10.1234/B2".to_string());
let resp = client