Browse Source

unsuccessful dyn bag creation with invalid expected data fee

ignazio 3 years ago
parent
commit
44a9d1b1e9
1 changed files with 15 additions and 0 deletions
  1. 15 0
      runtime-modules/storage/src/tests/mod.rs

+ 15 - 0
runtime-modules/storage/src/tests/mod.rs

@@ -5303,6 +5303,7 @@ fn unsuccessful_dyn_bag_creation_with_empty_ipfs_ids() {
             .call_and_assert(Err(Error::<Test>::EmptyContentId.into()));
     })
 }
+
 #[test]
 fn unsuccessful_dyn_bag_creation_with_empty_objects_list() {
     build_test_externalities().execute_with(|| {
@@ -5317,6 +5318,20 @@ fn unsuccessful_dyn_bag_creation_with_empty_objects_list() {
     })
 }
 
+#[test]
+fn unsuccessful_dyn_bag_creation_with_invalid_expected_data_fee() {
+    build_test_externalities().execute_with(|| {
+        run_to_block(1);
+
+        create_storage_buckets(DEFAULT_STORAGE_BUCKETS_NUMBER);
+        increase_account_balance(&DEFAULT_MEMBER_ACCOUNT_ID, INITIAL_BALANCE);
+
+        CreateDynamicBagWithObjectsFixture::default()
+            .with_expected_data_size_fee(Storage::data_object_per_mega_byte_fee() + 100)
+            .call_and_assert(Err(Error::<Test>::DataSizeFeeChanged.into()));
+    })
+}
+
 #[test]
 fn unsuccessful_dyn_bag_creation_with_dynamic_and_param_bag_differing() {
     build_test_externalities().execute_with(|| {