-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* clippy cleanup polished integration test setup * reduce chatter
- Loading branch information
Showing
6 changed files
with
54 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
on: [push] | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
name: build | ||
jobs: | ||
build: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
name: Security audit | ||
on: | ||
schedule: | ||
- cron: "0 8 * * *" | ||
push: | ||
paths: | ||
- "**/Cargo.*" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,32 @@ | ||
use se_ms_api::SolaredgeCredentials; | ||
use std::env; | ||
use std::fs; | ||
use std::sync::Once; | ||
|
||
pub const TIME_FORMAT: &'static str = "%Y-%m-%d %H:%M:%S"; | ||
pub const TIME_FORMAT: &str = "%Y-%m-%d %H:%M:%S"; | ||
|
||
const TEST_CREDENTIALS_FILE: &'static str = "test_credentials.txt"; | ||
const TEST_CREDENTIALS_FILE: &str = "test_credentials.txt"; | ||
|
||
static mut SITE_ID: String = String::new(); | ||
static mut API_KEY: String = String::new(); | ||
static INIT: Once = Once::new(); | ||
lazy_static! { | ||
pub static ref TEST_CREDENTIALS: SolaredgeCredentials = { | ||
let mut site_id = String::new(); | ||
let mut api_key = String::new(); | ||
|
||
pub fn get_site_id_and_api_key() -> (&'static str, &'static str) { | ||
unsafe { | ||
INIT.call_once(|| { | ||
let path = env::current_dir().unwrap(); | ||
let path = path.join("tests").join(TEST_CREDENTIALS_FILE); | ||
let path = env::current_dir().unwrap(); | ||
let path = path.join("tests").join(TEST_CREDENTIALS_FILE); | ||
|
||
let contents = fs::read_to_string(path) | ||
.expect(&format!("Unable to read {}.", TEST_CREDENTIALS_FILE)); | ||
let mut lines = contents.lines(); | ||
if let Some(s) = lines.next() { | ||
SITE_ID = s.to_string(); | ||
} | ||
if let Some(s) = lines.next() { | ||
API_KEY = s.to_string(); | ||
} | ||
if SITE_ID.len() == 0 || API_KEY.len() == 0 { | ||
panic!("Ill formed credentials file."); | ||
} | ||
}); | ||
(&SITE_ID, &API_KEY) | ||
} | ||
let contents = fs::read_to_string(path) | ||
.unwrap_or_else(|_| panic!("Unable to read {}.", TEST_CREDENTIALS_FILE)); | ||
let mut lines = contents.lines(); | ||
if let Some(s) = lines.next() { | ||
site_id = s.to_string(); | ||
} | ||
if let Some(s) = lines.next() { | ||
api_key = s.to_string(); | ||
} | ||
if site_id.is_empty() || api_key.is_empty() { | ||
panic!("Ill formed credentials file."); | ||
} | ||
|
||
SolaredgeCredentials::create(&site_id, &api_key) | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters