Skip to content

Commit d5fb905

Browse files
committed
Fix submissions API URL and incorrect warning
1 parent f67a98c commit d5fb905

File tree

6 files changed

+7
-9
lines changed

6 files changed

+7
-9
lines changed

crates/bindings/tmc-langs-node/jest/mock_server.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ app.post("/api/v8/core/submissions/:x/feedback", (_req, res) => {
274274
status: "processing",
275275
});
276276
});
277-
app.get("/api/v8/core/submission/:x", (_req, res) => {
277+
app.get("/api/v8/core/submissions/:x", (_req, res) => {
278278
res.send({
279279
api_version: 0,
280280
user_id: 1,

crates/helpers/tmc-server-mock/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ pub fn get_credentials(server: &mut Server) -> Mock {
211211
}
212212

213213
pub fn get_submission(server: &mut Server) -> Mock {
214-
mocker!(server, "GET", "/api/v8/core/submission/{}", {
214+
mocker!(server, "GET", "/api/v8/core/submissions/{}", {
215215
"api_version": 0,
216216
"user_id": USER_ID,
217217
"login": "",

crates/tmc-langs-cli/src/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -550,8 +550,6 @@ fn run_tmc(tmc: TestMyCode) -> Result<CliOutput> {
550550
credentials.remove()?;
551551
}
552552
return Err(InvalidTokenError { source: error }.into());
553-
} else {
554-
log::warn!("401 without credentials");
555553
}
556554
}
557555
}

crates/tmc-testmycode-client/src/client.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -815,7 +815,7 @@ mod test {
815815
let mut server = Server::new();
816816
let client = make_client(&server);
817817
let m = server
818-
.mock("GET", "/api/v8/core/submission/0")
818+
.mock("GET", "/api/v8/core/submissions/0")
819819
.match_query(Matcher::AllOf(vec![
820820
Matcher::UrlEncoded("client".to_string(), "some_client".to_string()),
821821
Matcher::UrlEncoded("client_version".to_string(), "some_ver".to_string()),

crates/tmc-testmycode-client/src/client/api_v8.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -174,13 +174,13 @@ pub fn get_credentials(
174174
get_json(client, url, &[])
175175
}
176176

177-
/// get /api/v8/core/submission/{submission_id}
177+
/// get /api/v8/core/submissions/{submission_id}
178178
/// Checks the submission processing status from the given URL.
179179
pub fn get_submission(
180180
client: &TestMyCodeClient,
181181
submission_id: u32,
182182
) -> Result<SubmissionProcessingStatus, TestMyCodeClientError> {
183-
let url = make_url(client, format!("/api/v8/core/submission/{submission_id}"))?;
183+
let url = make_url(client, format!("/api/v8/core/submissions/{submission_id}"))?;
184184
get_json(client, url, &[])
185185
}
186186

@@ -1080,7 +1080,7 @@ mod test {
10801080
let mut server = Server::new();
10811081

10821082
let client = make_client(&server);
1083-
let _m = server.mock("GET", "/api/v8/core/submission/0")
1083+
let _m = server.mock("GET", "/api/v8/core/submissions/0")
10841084
.match_query(Matcher::AllOf(vec![
10851085
Matcher::UrlEncoded("client".into(), "client".into()),
10861086
Matcher::UrlEncoded("client_version".into(), "version".into()),

crates/tmc-testmycode-client/src/response.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ pub struct NewSubmission {
346346
pub submission_url: String,
347347
}
348348

349-
/// get /api/v8/core/submission/{submission_id}
349+
/// get /api/v8/core/submissions/{submission_id}
350350
#[derive(Debug, Deserialize, Serialize)]
351351
#[serde(untagged)] // TODO: tag
352352
pub enum SubmissionProcessingStatus {

0 commit comments

Comments
 (0)