summaryrefslogtreecommitdiffstats
path: root/rust/tests/test_old_python_tests.rs
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2019-01-08 16:28:27 -0800
committerBryan Newbold <bnewbold@robocracy.org>2019-01-08 16:28:27 -0800
commit16f2e78298dbd2231f5f337ea17c89a6a131a052 (patch)
tree6e72581e625e73c97cbab72d0f9c35665c99e5d7 /rust/tests/test_old_python_tests.rs
parenteb40a5f274f3608db34309cfd16739a7642ef5e7 (diff)
parentffb721f90c5d97ee80885209bf45feb85ca9625c (diff)
downloadfatcat-16f2e78298dbd2231f5f337ea17c89a6a131a052.tar.gz
fatcat-16f2e78298dbd2231f5f337ea17c89a6a131a052.zip
Merge branch 'bnewbold-crude-auth'
Fixed a conflict in: python/fatcat_export.py
Diffstat (limited to 'rust/tests/test_old_python_tests.rs')
-rw-r--r--rust/tests/test_old_python_tests.rs71
1 files changed, 40 insertions, 31 deletions
diff --git a/rust/tests/test_old_python_tests.rs b/rust/tests/test_old_python_tests.rs
index b3d4a316..4fc1ffaf 100644
--- a/rust/tests/test_old_python_tests.rs
+++ b/rust/tests/test_old_python_tests.rs
@@ -15,14 +15,15 @@ use fatcat_api_spec::*;
mod helpers;
use helpers::setup_client;
-#[test]
+//#[test]
fn test_api_rich_create() {
- let (client, mut server) = setup_client();
- let client = client.with_context(Context::new());
+ let (client, context, mut server) = setup_client();
+ let client = client.with_context(context);
let admin_id = "aaaaaaaaaaaabkvkaaaaaaaaae".to_string();
- let mut new_eg = Editgroup::new(admin_id);
+ let mut new_eg = Editgroup::new();
+ new_eg.editor_id = Some(admin_id);
new_eg.description = Some("a unit test edit".to_string());
let resp = client.create_editgroup(new_eg).wait().unwrap();
let editgroup_id = match resp {
@@ -189,20 +190,18 @@ fn test_api_rich_create() {
* because of any problem with this particular test... though this test isn't doing much right now
* anyways.
*/
-/*
-#[test]
+//#[test]
fn test_merge_works() {
- let (client, mut server) = setup_client();
- let client = client.with_context(Context::new());
+ let (client, context, mut server) = setup_client();
+ let client = client.with_context(context);
let admin_id = "aaaaaaaaaaaabkvkaaaaaaaaae".to_string();
- let resp = client
- .create_editgroup(Editgroup::new(admin_id))
- .wait()
- .unwrap();
+ let mut eg = Editgroup::new();
+ eg.editor_id = Some(admin_id);
+ let resp = client.create_editgroup(eg).wait().unwrap();
let editgroup_id = match resp {
- CreateEditgroupResponse::SuccessfullyCreated(eg) => eg.id.unwrap(),
+ CreateEditgroupResponse::SuccessfullyCreated(eg) => eg.editgroup_id.unwrap(),
_ => unreachable!(),
};
@@ -216,7 +215,8 @@ fn test_merge_works() {
CreateWorkResponse::CreatedEntity(ee) => ee.ident,
_ => unreachable!(),
};
- let mut new_release = ReleaseEntity::new("some release".to_string());
+ let mut new_release = ReleaseEntity::new();
+ new_release.title = Some("some release".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());
@@ -238,7 +238,8 @@ fn test_merge_works() {
_ => unreachable!(),
};
- let mut new_release = ReleaseEntity::new("some release".to_string());
+ let mut new_release = ReleaseEntity::new();
+ new_release.title = Some("some release".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());
@@ -251,7 +252,8 @@ fn test_merge_works() {
_ => unreachable!(),
};
- let mut new_release = ReleaseEntity::new("some release".to_string());
+ let mut new_release = ReleaseEntity::new();
+ new_release.title = Some("some release".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());
@@ -276,20 +278,27 @@ fn test_merge_works() {
/* TODO:
// merge works
client.merge_works(work_a_id, work_b_id)
-*/
-// check results
-let work_a = match client.get_work(work_a_id.clone(), None).wait().unwrap() {
-GetWorkResponse::FoundEntity(e) => e,
-_ => unreachable!(),
-};
-let _work_b = match client.get_work(work_b_id.clone(), None).wait().unwrap() {
-GetWorkResponse::FoundEntity(e) => e,
-_ => unreachable!(),
-};
-// TODO: assert_eq!(work_a.revision.unwrap(), work_b.revision.unwrap());
-assert_eq!(work_a.redirect, None);
-// TODO: assert_eq!(work_b.redirect, Some(work_a_id));
+ */
+ // check results
+ let work_a = match client
+ .get_work(work_a_id.clone(), None, None)
+ .wait()
+ .unwrap()
+ {
+ GetWorkResponse::FoundEntity(e) => e,
+ _ => unreachable!(),
+ };
+ let _work_b = match client
+ .get_work(work_b_id.clone(), None, None)
+ .wait()
+ .unwrap()
+ {
+ GetWorkResponse::FoundEntity(e) => e,
+ _ => unreachable!(),
+ };
+ // TODO: assert_eq!(work_a.revision.unwrap(), work_b.revision.unwrap());
+ assert_eq!(work_a.redirect, None);
+ // TODO: assert_eq!(work_b.redirect, Some(work_a_id));
-server.close().unwrap()
+ server.close().unwrap()
}
-*/