aboutsummaryrefslogtreecommitdiffstats
path: root/rust/tests/test_api_server.rs
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2018-09-06 15:02:57 -0700
committerBryan Newbold <bnewbold@robocracy.org>2018-09-06 15:02:59 -0700
commit0f229e57965901a1230dd346fb676e8caf67ec2e (patch)
tree4d8af9a9aa99dcd67ce8ce15fdfc7484d8b77856 /rust/tests/test_api_server.rs
parent36a1fbe4ce13be3631e07a5ecfc84ffc87c74931 (diff)
downloadfatcat-0f229e57965901a1230dd346fb676e8caf67ec2e.tar.gz
fatcat-0f229e57965901a1230dd346fb676e8caf67ec2e.zip
skeleton create/delete endpoints for works
Other entities just stubs
Diffstat (limited to 'rust/tests/test_api_server.rs')
-rw-r--r--rust/tests/test_api_server.rs65
1 files changed, 65 insertions, 0 deletions
diff --git a/rust/tests/test_api_server.rs b/rust/tests/test_api_server.rs
index 02c77413..4b181188 100644
--- a/rust/tests/test_api_server.rs
+++ b/rust/tests/test_api_server.rs
@@ -469,6 +469,71 @@ fn test_post_work() {
}
#[test]
+fn test_update_work() {
+ let (headers, router, conn) = setup();
+
+ check_response(
+ request::post(
+ "http://localhost:9411/v0/work",
+ headers.clone(),
+ r#"{
+ "extra": { "source": "other speculation" }
+ }"#,
+ &router,
+ ),
+ status::Created,
+ None,
+ );
+
+ let editor_id = Uuid::parse_str("00000000-0000-0000-AAAA-000000000001").unwrap();
+ let editgroup_id = get_or_create_editgroup(editor_id, &conn).unwrap();
+ check_response(
+ request::post(
+ &format!(
+ "http://localhost:9411/v0/editgroup/{}/accept",
+ uuid2fcid(&editgroup_id)
+ ),
+ headers.clone(),
+ "",
+ &router,
+ ),
+ status::Ok,
+ None,
+ );
+}
+
+#[test]
+fn test_delete_work() {
+ let (headers, router, conn) = setup();
+
+ check_response(
+ request::delete(
+ "http://localhost:9411/v0/work/aaaaaaaaaaaaavkvaaaaaaaaai",
+ headers.clone(),
+ &router,
+ ),
+ status::Ok,
+ None,
+ );
+
+ let editor_id = Uuid::parse_str("00000000-0000-0000-AAAA-000000000001").unwrap();
+ let editgroup_id = get_or_create_editgroup(editor_id, &conn).unwrap();
+ check_response(
+ request::post(
+ &format!(
+ "http://localhost:9411/v0/editgroup/{}/accept",
+ uuid2fcid(&editgroup_id)
+ ),
+ headers.clone(),
+ "",
+ &router,
+ ),
+ status::Ok,
+ None,
+ );
+}
+
+#[test]
fn test_accept_editgroup() {
let (headers, router, conn) = setup();