aboutsummaryrefslogtreecommitdiffstats
path: root/rust/tests/helpers.rs
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2019-01-11 14:53:05 -0800
committerBryan Newbold <bnewbold@robocracy.org>2019-01-11 14:53:05 -0800
commitcfff2da3eb14a32c6942c043113b530b67b316c9 (patch)
treefefe630e97e2b056a2f5a9536606b0c646ff2c49 /rust/tests/helpers.rs
parent54e34ddd56b705cba239f88a9239c603d3ecd20e (diff)
downloadfatcat-cfff2da3eb14a32c6942c043113b530b67b316c9.tar.gz
fatcat-cfff2da3eb14a32c6942c043113b530b67b316c9.zip
refactor editgroup creation in test_api_server_http
Diffstat (limited to 'rust/tests/helpers.rs')
-rw-r--r--rust/tests/helpers.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/rust/tests/helpers.rs b/rust/tests/helpers.rs
index 2410aa32..fda5852f 100644
--- a/rust/tests/helpers.rs
+++ b/rust/tests/helpers.rs
@@ -1,7 +1,9 @@
use fatcat::auth::MacaroonAuthMiddleware;
+use fatcat::editing_crud::EditgroupCrud;
use fatcat::identifiers::FatcatId;
use fatcat::server;
use fatcat_api_spec::client::Client;
+use fatcat_api_spec::models::Editgroup;
use fatcat_api_spec::Context;
use iron::headers::{Authorization, Bearer, ContentType};
use iron::mime::Mime;
@@ -91,3 +93,19 @@ pub fn check_http_response(
assert!(body.contains(thing));
}
}
+
+pub fn quick_editgroup(conn: &server::DbConn) -> FatcatId {
+ let editor_id = FatcatId::from_str(TEST_ADMIN_EDITOR_ID).unwrap();
+ let eg = Editgroup {
+ editgroup_id: None,
+ editor_id: Some(editor_id.to_string()),
+ editor: None,
+ submitted: None,
+ description: None,
+ extra: None,
+ annotations: None,
+ edits: None,
+ };
+ let row = eg.db_create(conn, false).unwrap();
+ FatcatId::from_uuid(&row.id)
+}