Browse Source

Nope, no issue with badly initialized storage, just an issue with my
mocks and tests being bad. Nice, what you can miss.

Jens Finkhaeuser 6 years ago
parent
commit
4d67a7e02b
2 changed files with 9 additions and 7 deletions
  1. 7 5
      src/storage/data_object_storage_registry.rs
  2. 2 2
      src/storage/mock.rs

+ 7 - 5
src/storage/data_object_storage_registry.rs

@@ -195,7 +195,7 @@ mod tests {
         with_default_mock_builder(|| {
             // The content needs to exist - in our mock, that's with the content ID TEST_MOCK_EXISTING_CID
             let res = TestDataObjectStorageRegistry::add_relationship(
-                Origin::signed(1),
+                Origin::signed(TEST_MOCK_LIAISON),
                 TEST_MOCK_EXISTING_CID,
             );
             assert!(res.is_ok());
@@ -215,7 +215,7 @@ mod tests {
         with_default_mock_builder(|| {
             // Create a DOSR
             let res = TestDataObjectStorageRegistry::add_relationship(
-                Origin::signed(1),
+                Origin::signed(TEST_MOCK_LIAISON),
                 TEST_MOCK_EXISTING_CID,
             );
             assert!(res.is_ok());
@@ -240,14 +240,16 @@ mod tests {
 
             // Toggling with the wrong ID should fail.
             let res = TestDataObjectStorageRegistry::set_relationship_ready(
-                Origin::signed(1),
+                Origin::signed(TEST_MOCK_LIAISON),
                 dosr_id + 1,
             );
             assert!(res.is_err());
 
             // Toggling with the correct ID and origin should succeed
-            let res =
-                TestDataObjectStorageRegistry::set_relationship_ready(Origin::signed(1), dosr_id);
+            let res = TestDataObjectStorageRegistry::set_relationship_ready(
+                Origin::signed(TEST_MOCK_LIAISON),
+                dosr_id,
+            );
             assert!(res.is_ok());
             assert_eq!(System::events().last().unwrap().event,
                 MetaEvent::data_object_storage_registry(data_object_storage_registry::RawEvent::DataObjectStorageRelationshipReadyUpdated(

+ 2 - 2
src/storage/mock.rs

@@ -65,10 +65,10 @@ impl traits::Roles<Test> for MockRoles {
     }
 
     fn account_has_role(
-        _account_id: &<Test as system::Trait>::AccountId,
+        account_id: &<Test as system::Trait>::AccountId,
         _role: actors::Role,
     ) -> bool {
-        false
+        *account_id == TEST_MOCK_LIAISON
     }
 
     fn random_account_for_role(