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

@@ -2,12 +2,14 @@ use std::collections::HashMap;
use crate::common::api_common::{ApiProject, ApiTeams, ApiUser, ApiVersion, AppendsOptionalPat};
use crate::common::dummy_data::{DummyImage, DummyProjectAlpha, DummyProjectBeta};
use actix_http::StatusCode;
use actix_web::test;
use chrono::{Duration, Utc};
use common::api_common::models::CommonItemType;
use common::api_common::Api;
use common::api_v3::request_data::get_public_project_creation_data;
use common::api_v3::ApiV3;
use common::asserts::assert_status;
use common::dummy_data::TestFile;
use common::environment::{with_test_environment, with_test_environment_all, TestEnvironment};
use common::{database::*, scopes::ScopeTest};
@@ -114,7 +116,7 @@ pub async fn notifications_scopes() {
.api
.add_user_to_team(alpha_team_id, FRIEND_USER_ID, None, None, USER_USER_PAT)
.await;
assert_eq!(resp.status(), 204);
assert_status(&resp, StatusCode::NO_CONTENT);
// Notification get
let read_notifications = Scopes::NOTIFICATION_READ;
@@ -187,7 +189,7 @@ pub async fn notifications_scopes() {
.api
.add_user_to_team(alpha_team_id, MOD_USER_ID, None, None, USER_USER_PAT)
.await;
assert_eq!(resp.status(), 204);
assert_status(&resp, StatusCode::NO_CONTENT);
let read_notifications = Scopes::NOTIFICATION_READ;
let req_gen = |pat: Option<String>| async move {
api.get_user_notifications(MOD_USER_ID, pat.as_deref())
@@ -386,7 +388,7 @@ pub async fn project_version_reads_scopes() {
.api
.edit_version(beta_version_id, json!({ "status": "draft" }), USER_USER_PAT)
.await;
assert_eq!(resp.status(), 204);
assert_status(&resp, StatusCode::NO_CONTENT);
let req_gen = |pat: Option<String>| async move {
api.get_version_from_hash(beta_file_hash, "sha1", pat.as_deref())
@@ -1084,7 +1086,7 @@ pub async fn organization_scopes() {
// Create organization
let organization_create = Scopes::ORGANIZATION_CREATE;
let req_gen = |pat: Option<String>| async move {
api.create_organization("TestOrg", "TestOrg Description", pat.as_deref())
api.create_organization("Test Org", "TestOrg", "TestOrg Description", pat.as_deref())
.await
};
let (_, success) = ScopeTest::new(&test_env)