chore: cleaning code

This commit is contained in:
grimhilt
2024-03-17 00:20:58 +01:00
parent a1b9cde71a
commit dc7df00ac9
13 changed files with 26 additions and 62 deletions

View File

@@ -1,12 +1,13 @@
use std::str;
use std::process::{Command, Output};
use std::fs::{self, File};
use std::io::{Write, BufReader, BufRead};
use std::io::Write;
use std::env;
use std::path::PathBuf;
use super::files_utils::has_files;
#[cfg(test)]
pub struct ClientTest {
user: String, // the nextcloud user
volume: String, // temp dir for the test
@@ -14,6 +15,7 @@ pub struct ClientTest {
exe_path: PathBuf, // absolute path of nextsync executable
}
#[cfg(test)]
impl ClientTest {
pub fn new(id: String) -> Self {
// create a directory in /tmp with the given id

View File

@@ -1,7 +1,8 @@
use std::io::{BufReader, BufRead, Write};
use std::fs::{File};
use std::io::{BufReader, BufRead};
use std::fs::File;
use std::path::PathBuf;
#[cfg(test)]
pub fn has_files(full_path: PathBuf, file: &str, content: &str, test_id: String) -> bool
{
if !full_path.exists() {

View File

@@ -1,7 +1,7 @@
use std::process::Command;
use std::os::unix::fs::PermissionsExt;
use std::fs::{self, File, Permissions};
use std::io::{BufReader, BufRead, Write};
use std::io::Write;
use std::env;
use std::path::PathBuf;

View File

@@ -1,4 +1,5 @@
#[cfg(test)]
pub fn lines_should_not_contains(lines: Vec<String>, str: &str) {
for line in lines {
if line.find(str).is_some() {

View File

@@ -1,5 +1,6 @@
use rand::{distributions::Alphanumeric, Rng};
#[cfg(test)]
pub fn get_random_test_id() -> String {
let mut id: String = rand::thread_rng()
.sample_iter(&Alphanumeric)