MetaSrc: Add datasource with champs list

This commit is contained in:
nyyu 2021-04-08 13:55:10 +02:00
parent c341827ec7
commit e43f6396b0
6 changed files with 86 additions and 9 deletions

View file

@ -1,4 +1,5 @@
use crate::data_source::{Build, DataSource, Item, Stat};
use crate::Champion as ChampionLoL;
use crate::ChampInfo;
use crate::USER_AGENT_VALUE;
use indexmap::IndexMap;
@ -296,7 +297,7 @@ impl DataSource for KBDataSource {
300
}
fn get_champs_with_positions(&self, client: &ureq::Agent) -> IndexMap<u32, Vec<String>> {
fn get_champs_with_positions(&self, client: &ureq::Agent, _champion: &ChampionLoL) -> IndexMap<u32, Vec<String>> {
let mut champions = IndexMap::new();
let data: ChampionResponse = match self.get_champion_response(client) {
Some(val) => val,
@ -376,7 +377,10 @@ mod tests {
.timeout(Duration::from_secs(10))
.build();
let datasource = KBDataSource::new();
let champs_with_positions = datasource.get_champs_with_positions(&client);
let champion = ChampionLoL {
data: IndexMap::new()
};
let champs_with_positions = datasource.get_champs_with_positions(&client, &champion);
assert!(champs_with_positions.len() > 0);
}