Skip to content

Commit

Permalink
fix: merge conflict issues
Browse files Browse the repository at this point in the history
Signed-off-by: Lachezar Lechev <lachezar@ambire.com>
  • Loading branch information
elpiel committed Jul 13, 2023
1 parent 5e949d5 commit f409b27
Show file tree
Hide file tree
Showing 19 changed files with 64 additions and 9 deletions.
8 changes: 8 additions & 0 deletions examples/types/notifications.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
use stremio_core::types::notification::notification_item::tests::NOTIFICATION;

#[test]
fn test_notification_json() {
let notification = NOTIFICATION.clone();

println!("{}", serde_json::to_string_pretty(&notification).unwrap());
}
5 changes: 1 addition & 4 deletions src/models/ctx/ctx.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
use crate::constants::LIBRARY_COLLECTION_NAME;
use crate::models::common::{DescriptorLoadable, ResourceLoadable};
use crate::models::ctx::{
update_library, update_notifications, update_profile, update_trakt_addon, CtxError,
};
use crate::models::ctx::{update_library, update_profile, update_streams, CtxError, OtherError};
use crate::models::ctx::{update_library, update_profile, update_trakt_addon,update_notifications, update_streams, CtxError};
use crate::runtime::msg::{Action, ActionCtx, Event, Internal, Msg};
use crate::runtime::{Effect, EffectFuture, Effects, Env, EnvFutureExt, Update};
use crate::types::api::{
Expand Down
3 changes: 3 additions & 0 deletions src/unit_tests/catalog_with_filters/load_action.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use crate::types::library::LibraryBucket;
use crate::types::notifications::NotificationsBucket;
use crate::types::profile::Profile;
use crate::types::resource::MetaItemPreview;
use crate::types::streams::StreamsBucket;
use crate::unit_tests::{
default_fetch_handler, Request, TestEnv, EVENTS, FETCH_HANDLER, REQUESTS, STATES,
};
Expand Down Expand Up @@ -46,6 +47,7 @@ fn default_catalog() {
let ctx = Ctx::new(
Profile::default(),
LibraryBucket::default(),
StreamsBucket::default(),
NotificationsBucket::new::<TestEnv>(None, vec![]),
);
let (discover, effects) = CatalogWithFilters::<MetaItemPreview>::new(&ctx.profile);
Expand Down Expand Up @@ -144,6 +146,7 @@ fn search_catalog() {
let ctx = Ctx::new(
Profile::default(),
LibraryBucket::default(),
StreamsBucket::default(),
NotificationsBucket::new::<TestEnv>(None, vec![]),
);
let (discover, effects) = CatalogWithFilters::<MetaItemPreview>::new(&ctx.profile);
Expand Down
3 changes: 3 additions & 0 deletions src/unit_tests/ctx/add_to_library.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use crate::types::notifications::NotificationsBucket;
use crate::types::profile::{Auth, AuthKey, GDPRConsent, Profile, User};
use crate::types::resource::{MetaItemBehaviorHints, MetaItemPreview, PosterShape};
use crate::types::True;
use crate::types::streams::StreamsBucket;
use crate::unit_tests::{
default_fetch_handler, Request, TestEnv, FETCH_HANDLER, NOW, REQUESTS, STORAGE,
};
Expand Down Expand Up @@ -103,6 +104,7 @@ fn actionctx_addtolibrary() {
uid: Some("id".to_owned()),
..Default::default()
},
StreamsBucket::default(),
NotificationsBucket::new::<TestEnv>(None, vec![]),
),
},
Expand Down Expand Up @@ -237,6 +239,7 @@ fn actionctx_addtolibrary_already_added() {
.into_iter()
.collect(),
},
StreamsBucket::default(),
NotificationsBucket::new::<TestEnv>(None, vec![]),
),
},
Expand Down
4 changes: 4 additions & 0 deletions src/unit_tests/ctx/authenticate.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::types::notifications::NotificationsBucket;
use crate::types::streams::StreamsBucket;
use crate::{
constants::{LIBRARY_RECENT_STORAGE_KEY, LIBRARY_STORAGE_KEY, PROFILE_STORAGE_KEY},
models::ctx::Ctx,
Expand Down Expand Up @@ -86,6 +87,7 @@ fn actionctx_authenticate_login() {
let ctx = Ctx::new(
Profile::default(),
LibraryBucket::default(),
StreamsBucket::default(),
NotificationsBucket::new::<TestEnv>(None, vec![]),
);
let (runtime, _rx) = Runtime::<TestEnv, _>::new(TestModel { ctx }, vec![], 1000);
Expand Down Expand Up @@ -290,6 +292,7 @@ fn actionctx_authenticate_login_with_token() {
let ctx = Ctx::new(
Profile::default(),
LibraryBucket::default(),
StreamsBucket::default(),
NotificationsBucket::new::<TestEnv>(None, vec![]),
);
let (runtime, _rx) = Runtime::<TestEnv, _>::new(TestModel { ctx }, vec![], 1000);
Expand Down Expand Up @@ -493,6 +496,7 @@ fn actionctx_authenticate_register() {
let ctx = Ctx::new(
Profile::default(),
LibraryBucket::default(),
StreamsBucket::default(),
NotificationsBucket::new::<TestEnv>(None, vec![]),
);
let (runtime, _rx) = Runtime::<TestEnv, _>::new(TestModel { ctx }, vec![], 1000);
Expand Down
5 changes: 5 additions & 0 deletions src/unit_tests/ctx/install_addon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use crate::types::library::LibraryBucket;
use crate::types::notifications::NotificationsBucket;
use crate::types::profile::{Auth, AuthKey, GDPRConsent, Profile, User};
use crate::types::True;
use crate::types::streams::StreamsBucket;
use crate::unit_tests::{
default_fetch_handler, Request, TestEnv, FETCH_HANDLER, REQUESTS, STORAGE,
};
Expand Down Expand Up @@ -52,6 +53,7 @@ fn actionctx_installaddon_install() {
..Default::default()
},
LibraryBucket::default(),
StreamsBucket::default(),
NotificationsBucket::new::<TestEnv>(None, vec![]),
),
},
Expand Down Expand Up @@ -155,6 +157,7 @@ fn actionctx_installaddon_install_with_user() {
..Default::default()
},
LibraryBucket::default(),
StreamsBucket::default(),
NotificationsBucket::new::<TestEnv>(None, vec![]),
),
},
Expand Down Expand Up @@ -275,6 +278,7 @@ fn actionctx_installaddon_update() {
..Default::default()
},
LibraryBucket::default(),
StreamsBucket::default(),
NotificationsBucket::new::<TestEnv>(None, vec![]),
),
},
Expand Down Expand Up @@ -349,6 +353,7 @@ fn actionctx_installaddon_already_installed() {
ctx: Ctx::new(
profile,
LibraryBucket::default(),
StreamsBucket::default(),
NotificationsBucket::new::<TestEnv>(None, vec![]),
),
},
Expand Down
2 changes: 2 additions & 0 deletions src/unit_tests/ctx/logout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use crate::types::library::LibraryBucket;
use crate::types::notifications::NotificationsBucket;
use crate::types::profile::{Auth, AuthKey, GDPRConsent, Profile, User};
use crate::types::True;
use crate::types::streams::StreamsBucket;
use crate::unit_tests::{
default_fetch_handler, Request, TestEnv, FETCH_HANDLER, REQUESTS, STORAGE,
};
Expand Down Expand Up @@ -82,6 +83,7 @@ fn actionctx_logout() {
ctx: Ctx::new(
profile,
library,
StreamsBucket::default(),
NotificationsBucket::new::<TestEnv>(None, vec![]),
),
},
Expand Down
4 changes: 3 additions & 1 deletion src/unit_tests/ctx/notifications/notifications.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use crate::types::addon::{Descriptor, ResourceResponse};
use crate::types::library::{LibraryBucket, LibraryItem};
use crate::types::notifications::{NotificationItem, NotificationsBucket};
use crate::types::profile::Profile;
use crate::types::streams::StreamsBucket;
use crate::unit_tests::{default_fetch_handler, Request, TestEnv, FETCH_HANDLER};
use enclose::enclose;
use futures::future;
Expand All @@ -28,7 +29,7 @@ struct TestData {
fn notifications() {
let tests = serde_json::from_slice::<Vec<TestData>>(DATA).unwrap();
for test in tests {
#[derive(Model)]
#[derive(Model, Clone, Debug)]
#[model(TestEnv)]
struct TestModel {
ctx: Ctx,
Expand All @@ -50,6 +51,7 @@ fn notifications() {
..Default::default()
},
LibraryBucket::new(None, test.library_items),
StreamsBucket::default(),
NotificationsBucket::new::<TestEnv>(None, test.notification_items),
),
},
Expand Down
3 changes: 3 additions & 0 deletions src/unit_tests/ctx/pull_addons_from_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use crate::types::api::{APIResult, CollectionResponse};
use crate::types::library::LibraryBucket;
use crate::types::notifications::NotificationsBucket;
use crate::types::profile::{Auth, AuthKey, GDPRConsent, Profile, User};
use crate::types::streams::StreamsBucket;
use crate::unit_tests::{
default_fetch_handler, Request, TestEnv, FETCH_HANDLER, REQUESTS, STORAGE,
};
Expand Down Expand Up @@ -40,6 +41,7 @@ fn actionctx_pulladdonsfromapi() {
..Default::default()
},
LibraryBucket::default(),
StreamsBucket::default(),
NotificationsBucket::new::<TestEnv>(None, vec![]),
),
},
Expand Down Expand Up @@ -146,6 +148,7 @@ fn actionctx_pulladdonsfromapi_with_user() {
..Default::default()
},
LibraryBucket::default(),
StreamsBucket::default(),
NotificationsBucket::new::<TestEnv>(None, vec![]),
),
},
Expand Down
4 changes: 3 additions & 1 deletion src/unit_tests/ctx/pull_notifications.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use crate::types::profile::Profile;
use crate::types::resource::{
MetaItem, MetaItemPreview, PosterShape, SeriesInfo, Stream, StreamSource, Video,
};
use crate::types::streams::StreamsBucket;
use crate::unit_tests::{default_fetch_handler, Request, TestEnv, FETCH_HANDLER, REQUESTS};
use chrono::TimeZone;
use chrono::Utc;
Expand All @@ -24,7 +25,7 @@ use url::Url;

#[test]
fn pull_notifications() {
#[derive(Model)]
#[derive(Model, Clone, Debug)]
#[model(TestEnv)]
struct TestModel {
ctx: Ctx,
Expand Down Expand Up @@ -197,6 +198,7 @@ fn pull_notifications() {
behavior_hints: Default::default(),
}],
),
StreamsBucket::default(),
NotificationsBucket::new::<TestEnv>(None, vec![]),
),
player: Default::default(),
Expand Down
3 changes: 3 additions & 0 deletions src/unit_tests/ctx/push_addons_to_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use crate::types::library::LibraryBucket;
use crate::types::notifications::NotificationsBucket;
use crate::types::profile::{Auth, AuthKey, GDPRConsent, Profile, User};
use crate::types::True;
use crate::types::streams::StreamsBucket;
use crate::unit_tests::{default_fetch_handler, Request, TestEnv, FETCH_HANDLER, REQUESTS};
use futures::future;
use semver::Version;
Expand Down Expand Up @@ -48,6 +49,7 @@ fn actionctx_pushaddonstoapi() {
..Default::default()
},
LibraryBucket::default(),
StreamsBucket::default(),
NotificationsBucket::new::<TestEnv>(None, vec![]),
),
},
Expand Down Expand Up @@ -135,6 +137,7 @@ fn actionctx_pushaddonstoapi_with_user() {
..Default::default()
},
LibraryBucket::default(),
StreamsBucket::default(),
NotificationsBucket::new::<TestEnv>(None, vec![]),
),
},
Expand Down
3 changes: 3 additions & 0 deletions src/unit_tests/ctx/remove_from_library.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use crate::types::library::{LibraryBucket, LibraryItem};
use crate::types::notifications::NotificationsBucket;
use crate::types::profile::{Auth, AuthKey, GDPRConsent, Profile, User};
use crate::types::True;
use crate::types::streams::StreamsBucket;
use crate::unit_tests::{
default_fetch_handler, Request, TestEnv, FETCH_HANDLER, NOW, REQUESTS, STORAGE,
};
Expand Down Expand Up @@ -97,6 +98,7 @@ fn actionctx_removefromlibrary() {
.into_iter()
.collect(),
},
StreamsBucket::default(),
NotificationsBucket::new::<TestEnv>(None, vec![]),
),
},
Expand Down Expand Up @@ -182,6 +184,7 @@ fn actionctx_removefromlibrary_not_added() {
.into_iter()
.collect(),
},
StreamsBucket::default(),
NotificationsBucket::new::<TestEnv>(None, vec![]),
),
},
Expand Down
3 changes: 3 additions & 0 deletions src/unit_tests/ctx/rewind_library_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use crate::types::library::{LibraryBucket, LibraryItem, LibraryItemState};
use crate::types::notifications::NotificationsBucket;
use crate::types::profile::{Auth, AuthKey, GDPRConsent, Profile, User};
use crate::types::True;
use crate::types::streams::StreamsBucket;
use crate::unit_tests::{
default_fetch_handler, Request, TestEnv, FETCH_HANDLER, NOW, REQUESTS, STORAGE,
};
Expand Down Expand Up @@ -103,6 +104,7 @@ fn actionctx_rewindlibraryitem() {
.into_iter()
.collect(),
},
StreamsBucket::default(),
NotificationsBucket::new::<TestEnv>(None, vec![]),
),
},
Expand Down Expand Up @@ -191,6 +193,7 @@ fn actionctx_rewindlibraryitem_not_added() {
.into_iter()
.collect(),
},
StreamsBucket::default(),
NotificationsBucket::new::<TestEnv>(None, vec![]),
),
},
Expand Down
4 changes: 4 additions & 0 deletions src/unit_tests/ctx/sync_library_with_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use crate::types::library::{LibraryBucket, LibraryItem};
use crate::types::notifications::NotificationsBucket;
use crate::types::profile::{Auth, AuthKey, GDPRConsent, Profile, User};
use crate::types::True;
use crate::types::streams::StreamsBucket;
use crate::unit_tests::{
default_fetch_handler, Request, TestEnv, FETCH_HANDLER, REQUESTS, STORAGE,
};
Expand All @@ -29,6 +30,7 @@ fn actionctx_synclibrarywithapi() {
let ctx = Ctx::new(
Profile::default(),
LibraryBucket::default(),
StreamsBucket::default(),
NotificationsBucket::new::<TestEnv>(None, vec![]),
);
let (runtime, _rx) = Runtime::<TestEnv, _>::new(TestModel { ctx }, vec![], 1000);
Expand Down Expand Up @@ -286,6 +288,7 @@ fn actionctx_synclibrarywithapi_with_user() {
.into_iter()
.collect(),
},
StreamsBucket::default(),
NotificationsBucket::new::<TestEnv>(None, vec![]),
),
},
Expand Down Expand Up @@ -421,6 +424,7 @@ fn actionctx_synclibrarywithapi_with_user_empty_library() {
..Default::default()
},
LibraryBucket::default(),
StreamsBucket::default(),
NotificationsBucket::new::<TestEnv>(None, vec![]),
),
},
Expand Down
8 changes: 5 additions & 3 deletions src/unit_tests/ctx/uninstall_addon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use crate::types::library::LibraryBucket;
use crate::types::notifications::NotificationsBucket;
use crate::types::profile::{Auth, AuthKey, GDPRConsent, Profile, User};
use crate::types::True;
use crate::types::streams::StreamsBucket;
use crate::unit_tests::{
default_fetch_handler, Request, TestEnv, FETCH_HANDLER, REQUESTS, STORAGE,
};
Expand Down Expand Up @@ -57,6 +58,7 @@ fn actionctx_uninstalladdon() {
ctx: Ctx::new(
profile,
LibraryBucket::default(),
StreamsBucket::default(),
NotificationsBucket::new::<TestEnv>(None, vec![]),
),
},
Expand Down Expand Up @@ -166,7 +168,7 @@ fn actionctx_uninstalladdon_with_user() {
TestModel {
ctx: Ctx::new(
profile,
LibraryBucket::default(),
LibraryBucket::default(),StreamsBucket::default(),
NotificationsBucket::new::<TestEnv>(None, vec![]),
),
},
Expand Down Expand Up @@ -256,7 +258,7 @@ fn actionctx_uninstalladdon_protected() {
TestModel {
ctx: Ctx::new(
profile,
LibraryBucket::default(),
LibraryBucket::default(),StreamsBucket::default(),
NotificationsBucket::new::<TestEnv>(None, vec![]),
),
},
Expand Down Expand Up @@ -329,7 +331,7 @@ fn actionctx_uninstalladdon_not_installed() {
TestModel {
ctx: Ctx::new(
profile,
LibraryBucket::default(),
LibraryBucket::default(),StreamsBucket::default(),
NotificationsBucket::new::<TestEnv>(None, vec![]),
),
},
Expand Down
3 changes: 3 additions & 0 deletions src/unit_tests/ctx/update_settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use crate::runtime::{Runtime, RuntimeAction};
use crate::types::library::LibraryBucket;
use crate::types::notifications::NotificationsBucket;
use crate::types::profile::{Profile, Settings};
use crate::types::streams::StreamsBucket;
use crate::unit_tests::{TestEnv, REQUESTS, STORAGE};
use stremio_derive::Model;

Expand All @@ -24,6 +25,7 @@ fn actionctx_updatesettings() {
let ctx = Ctx::new(
Profile::default(),
LibraryBucket::default(),
StreamsBucket::default(),
NotificationsBucket::new::<TestEnv>(None, vec![]),
);
let (runtime, _rx) = Runtime::<TestEnv, _>::new(TestModel { ctx }, vec![], 1000);
Expand Down Expand Up @@ -80,6 +82,7 @@ fn actionctx_updatesettings_not_changed() {
ctx: Ctx::new(
profile,
LibraryBucket::default(),
StreamsBucket::default(),
NotificationsBucket::new::<TestEnv>(None, vec![]),
),
},
Expand Down
Loading

0 comments on commit f409b27

Please sign in to comment.