Fixes failing tests (#813)

* fixes failing  tests

* fmt clippy

* updated dockerfile

* fixes failing tests; adds important fix from extracts_versions PR

* assert_eq -> assert_status, giving better error messages

* fixed random failure bug

* fmt, clippy, etc
This commit is contained in:
Wyatt Verchere
2024-01-05 08:20:56 -08:00
committed by GitHub
parent f5802fee31
commit 10eed05d87
37 changed files with 555 additions and 330 deletions

View File

@@ -1,10 +1,12 @@
use std::collections::HashSet;
use actix_http::StatusCode;
use common::api_v3::ApiV3;
use common::environment::{with_test_environment, TestEnvironment};
use serde_json::json;
use crate::common::api_common::ApiVersion;
use crate::common::asserts::assert_status;
use crate::common::database::*;
use crate::common::dummy_data::{DummyProjectAlpha, DummyProjectBeta, TestFile};
@@ -49,7 +51,7 @@ async fn creating_loader_fields() {
USER_USER_PAT,
)
.await;
assert_eq!(resp.status(), 400);
assert_status(&resp, StatusCode::BAD_REQUEST);
// - Patch
let resp = api
.edit_version(
@@ -60,7 +62,7 @@ async fn creating_loader_fields() {
USER_USER_PAT,
)
.await;
assert_eq!(resp.status(), 400);
assert_status(&resp, StatusCode::BAD_REQUEST);
// Cannot create a version with a loader field that isnt used by the loader
// TODO: - Create project
@@ -82,7 +84,7 @@ async fn creating_loader_fields() {
USER_USER_PAT,
)
.await;
assert_eq!(resp.status(), 400);
assert_status(&resp, StatusCode::BAD_REQUEST);
// - Patch
let resp = api
.edit_version(
@@ -93,7 +95,7 @@ async fn creating_loader_fields() {
USER_USER_PAT,
)
.await;
assert_eq!(resp.status(), 400);
assert_status(&resp, StatusCode::BAD_REQUEST);
// Cannot create a version without an applicable loader field that is not optional
// TODO: - Create project
@@ -115,7 +117,7 @@ async fn creating_loader_fields() {
)
.await;
assert_eq!(resp.status(), 400);
assert_status(&resp, StatusCode::BAD_REQUEST);
// Cannot create a version without a loader field array that has a minimum of 1
// TODO: - Create project
@@ -136,7 +138,7 @@ async fn creating_loader_fields() {
USER_USER_PAT,
)
.await;
assert_eq!(resp.status(), 400);
assert_status(&resp, StatusCode::BAD_REQUEST);
// TODO: Create a test for too many elements in the array when we have a LF that has a max (past max)
// Cannot create a version with a loader field array that has fewer than the minimum elements
@@ -159,7 +161,7 @@ async fn creating_loader_fields() {
USER_USER_PAT,
)
.await;
assert_eq!(resp.status(), 400);
assert_status(&resp, StatusCode::BAD_REQUEST);
// - Patch
let resp = api
@@ -171,7 +173,7 @@ async fn creating_loader_fields() {
USER_USER_PAT,
)
.await;
assert_eq!(resp.status(), 400);
assert_status(&resp, StatusCode::BAD_REQUEST);
// Cannot create an invalid data type for the loader field type (including bad variant for the type)
for bad_type_game_versions in [
@@ -199,7 +201,7 @@ async fn creating_loader_fields() {
USER_USER_PAT,
)
.await;
assert_eq!(resp.status(), 400);
assert_status(&resp, StatusCode::BAD_REQUEST);
// - Patch
let resp = api
@@ -211,7 +213,7 @@ async fn creating_loader_fields() {
USER_USER_PAT,
)
.await;
assert_eq!(resp.status(), 400);
assert_status(&resp, StatusCode::BAD_REQUEST);
}
// Can create with optional loader fields (other tests have checked if we can create without them)
@@ -245,7 +247,7 @@ async fn creating_loader_fields() {
USER_USER_PAT,
)
.await;
assert_eq!(resp.status(), 204);
assert_status(&resp, StatusCode::NO_CONTENT);
let v = api
.get_version_deserialized(alpha_version_id, USER_USER_PAT)
.await;
@@ -296,7 +298,7 @@ async fn creating_loader_fields() {
USER_USER_PAT,
)
.await;
assert_eq!(resp.status(), 204);
assert_status(&resp, StatusCode::NO_CONTENT);
let v = api
.get_version_deserialized(alpha_version_id, USER_USER_PAT)
.await;