Skip to content

Commit 34839e7

Browse files
committed
tests: we need a CisClientError, not a failure::Error
Jira: IAM-1908
1 parent c4de05f commit 34839e7

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

tests/helpers/cis.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ impl AsyncCisClientTrait for CisFakeClient {
5656
}
5757
fn update_user(&self, id: &str, profile: Profile) -> CisFut<Value> {
5858
let mut store = self.store.write().unwrap();
59-
let p = if let Some(mut p) = store.get_mut(id) {
59+
let p = if let Some(p) = store.get_mut(id) {
6060
p.access_information.mozilliansorg = profile.access_information.mozilliansorg;
6161
p.clone()
6262
} else {
@@ -65,7 +65,17 @@ impl AsyncCisClientTrait for CisFakeClient {
6565
};
6666
match update_user_cache_unchecked(&self.pool, &p) {
6767
Ok(_) => Box::pin(ok(json!({}))),
68-
Err(e) => Box::pin(err(e)),
68+
Err(e) => {
69+
// DEBT: `update_user_cache_unchecked` and it's ilk return a
70+
// `failure::Error`.
71+
// There's no nice way to coerce this into a `CisClientError`,
72+
// which is what `CisFut` requires. The implementation, in
73+
// `db::internal::user::update_user_cache` doesn't even use
74+
// CIS!
75+
// For the tests, we'll just always return that a profile could
76+
// not be found, since we've already lost some information.
77+
Box::pin(err(ProfileError::ProfileDoesNotExist.into()))
78+
}
6979
}
7080
}
7181
fn update_users(&self, profiles: &[Profile]) -> CisFut<Value> {

0 commit comments

Comments
 (0)