excluding main and from impls from code coverage
This commit is contained in:
parent
5c4435430f
commit
7f289cce03
5 changed files with 16 additions and 0 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -2,3 +2,4 @@
|
|||
tarpaulin-report.html
|
||||
.env
|
||||
.env
|
||||
tarpaulin-report.html
|
||||
|
|
|
@ -75,7 +75,9 @@ pub struct ErrorToResponse {
|
|||
pub error: String,
|
||||
}
|
||||
|
||||
#[cfg(not(tarpaulin_include))]
|
||||
impl ResponseError for ServiceError {
|
||||
#[cfg(not(tarpaulin_include))]
|
||||
fn error_response(&self) -> HttpResponse {
|
||||
HttpResponseBuilder::new(self.status_code())
|
||||
.set_header(header::CONTENT_TYPE, "application/json; charset=UTF-8")
|
||||
|
@ -84,6 +86,7 @@ impl ResponseError for ServiceError {
|
|||
})
|
||||
}
|
||||
|
||||
#[cfg(not(tarpaulin_include))]
|
||||
fn status_code(&self) -> StatusCode {
|
||||
match *self {
|
||||
ServiceError::InternalServerError => StatusCode::INTERNAL_SERVER_ERROR,
|
||||
|
@ -102,6 +105,7 @@ impl ResponseError for ServiceError {
|
|||
}
|
||||
|
||||
impl From<CredsError> for ServiceError {
|
||||
#[cfg(not(tarpaulin_include))]
|
||||
fn from(e: CredsError) -> ServiceError {
|
||||
debug!("{:?}", &e);
|
||||
match e {
|
||||
|
@ -122,7 +126,10 @@ impl From<CredsError> for ServiceError {
|
|||
// }
|
||||
// }
|
||||
//
|
||||
|
||||
#[cfg(not(tarpaulin_include))]
|
||||
impl From<sqlx::Error> for ServiceError {
|
||||
#[cfg(not(tarpaulin_include))]
|
||||
fn from(e: sqlx::Error) -> Self {
|
||||
use sqlx::error::Error;
|
||||
use std::borrow::Cow;
|
||||
|
@ -137,4 +144,5 @@ impl From<sqlx::Error> for ServiceError {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(not(tarpaulin_include))]
|
||||
pub type ServiceResult<V> = std::result::Result<V, ServiceError>;
|
||||
|
|
|
@ -34,6 +34,7 @@ lazy_static! {
|
|||
pub static ref SETTINGS: Settings = Settings::new().unwrap();
|
||||
}
|
||||
|
||||
#[cfg(not(tarpaulin_include))]
|
||||
#[actix_web::main]
|
||||
async fn main() -> std::io::Result<()> {
|
||||
use api::v1::services as v1_services;
|
||||
|
|
|
@ -37,6 +37,7 @@ pub struct Captcha {
|
|||
}
|
||||
|
||||
impl Server {
|
||||
#[cfg(not(tarpaulin_include))]
|
||||
pub fn get_ip(&self) -> String {
|
||||
format!("{}:{}", self.ip, self.port)
|
||||
}
|
||||
|
@ -53,6 +54,7 @@ struct DatabaseBuilder {
|
|||
}
|
||||
|
||||
impl DatabaseBuilder {
|
||||
#[cfg(not(tarpaulin_include))]
|
||||
fn extract_database_url(url: &Url) -> Self {
|
||||
// if url.scheme() != "postgres" || url.scheme() != "postgresql" {
|
||||
// panic!("URL must be postgres://url, url found: {}", url.scheme());
|
||||
|
@ -125,6 +127,7 @@ impl Settings {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(not(tarpaulin_include))]
|
||||
fn set_from_database_url(s: &mut Config, database_conf: &DatabaseBuilder) {
|
||||
s.set("database.username", database_conf.username.clone())
|
||||
.expect("Couldn't set database username");
|
||||
|
@ -138,6 +141,7 @@ fn set_from_database_url(s: &mut Config, database_conf: &DatabaseBuilder) {
|
|||
.expect("Couldn't access database name");
|
||||
}
|
||||
|
||||
#[cfg(not(tarpaulin_include))]
|
||||
fn set_database_url(s: &mut Config) {
|
||||
s.set(
|
||||
"database.url",
|
||||
|
|
|
@ -24,9 +24,11 @@ pub use data::Data;
|
|||
pub use settings::Settings;
|
||||
|
||||
lazy_static! {
|
||||
#[cfg(not(tarpaulin_include))]
|
||||
pub static ref SETTINGS: Settings = Settings::new().unwrap();
|
||||
}
|
||||
|
||||
#[cfg(not(tarpaulin_include))]
|
||||
#[actix_web::main]
|
||||
async fn main() {
|
||||
let data = Data::new().await;
|
||||
|
|
Loading…
Add table
Reference in a new issue