From cfff2da3eb14a32c6942c043113b530b67b316c9 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Fri, 11 Jan 2019 14:53:05 -0800 Subject: refactor editgroup creation in test_api_server_http --- rust/tests/helpers.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'rust/tests/helpers.rs') 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) +} -- cgit v1.2.3