aleo-setup icon indicating copy to clipboard operation
aleo-setup copied to clipboard

Fix Try_Lock Test

Open apruden2008 opened this issue 4 years ago • 0 comments

Fix the test for the try_lock function

src/api/contributor/try_lock.rs

    // TODO fix this test
    #[ignore]
    #[test]
    #[serial]
    fn test_try_lock() {
        initialize_test_environment(&TEST_ENVIRONMENT);

        let (client, coordinator) = test_client(&TEST_ENVIRONMENT).unwrap();

        initialize_coordinator_aleo(&coordinator).unwrap();

        let rng = &mut ChaChaRng::seed_from_u64(1231275789u64);

        let method = "post";
        let path = "/api/coordinator/lock";

        println!("{:#?}", coordinator.current_round().unwrap());

        let authentication_header =
            AleoAuthentication::authenticate(&TEST_ALEO_CONTRIBUTOR_VIEW_KEY, method, path, rng).unwrap();

        let header = Header::new("Authorization", authentication_header.to_string());

        let mut response = client.post(path).header(header).dispatch();
        let response_body = response.body_string();
        assert_eq!(Status::Ok, response.status());
        assert_eq!(Some(ContentType::JSON), response.content_type());
        assert!(response_body.is_some());

        let candidate: ContributorLockResponse = serde_json::from_str(&response_body.unwrap()).unwrap();

        println!("candidate: {:#?}", candidate);

        assert_eq!(0, 1);
    }
}

apruden2008 avatar Feb 28 '21 01:02 apruden2008