Ejemplo n.º 1
0
 def test_get_models_which_should_be_exported(self):
     """Ensure that the set of models to export is the set of models with
     export policy CONTAINS_USER_DATA, and that all other models have
     export policy NOT_APPLICABLE.
     """
     all_models = [
         clazz for clazz in self._get_model_classes()
         if not clazz.__name__ in self.BASE_CLASSES
     ]
     models_with_export = (
         takeout_service.get_models_which_should_be_exported())
     unimplemented_models = set()
     for model in all_models:
         export_policy = model.get_export_policy()
         if model in models_with_export:
             self.assertEqual(base_models.EXPORT_POLICY.CONTAINS_USER_DATA,
                              export_policy)
         elif export_policy == base_models.EXPORT_POLICY.TO_BE_IMPLEMENTED:
             unimplemented_models.add(model)
         else:
             self.assertEqual(base_models.EXPORT_POLICY.NOT_APPLICABLE,
                              export_policy)
     # TODO(#8523): This list should not be modified under any circumstance.
     # The export_data functions for the models in this list will eventually
     # be implemented, and the TO_BE_IMPLEMENTED value will be removed.
     # Contact @varun-tandon for more information.
     expected_unimplemented = {
         collection_models.CollectionRightsSnapshotContentModel,
         collection_models.CollectionRightsSnapshotMetadataModel,
         collection_models.CollectionSnapshotContentModel,
         collection_models.CollectionSnapshotMetadataModel,
         collection_models.CollectionCommitLogEntryModel,
         skill_models.SkillSnapshotMetadataModel,
         skill_models.SkillSnapshotContentModel,
         topic_models.SubtopicPageSnapshotContentModel,
         topic_models.SubtopicPageSnapshotMetadataModel,
         topic_models.TopicRightsSnapshotContentModel,
         topic_models.TopicRightsSnapshotMetadataModel,
         topic_models.TopicSnapshotContentModel,
         topic_models.TopicSnapshotMetadataModel,
         user_models.UserContributionScoringModel,
         story_models.StorySnapshotContentModel,
         story_models.StorySnapshotMetadataModel,
         question_models.QuestionSnapshotContentModel,
         question_models.QuestionSnapshotMetadataModel,
         exploration_models.ExplorationRightsSnapshotContentModel,
         exploration_models.ExplorationRightsSnapshotMetadataModel,
         exploration_models.ExplorationSnapshotContentModel,
         exploration_models.ExplorationSnapshotMetadataModel,
         suggestion_models.GeneralVoiceoverApplicationModel,
         config_models.ConfigPropertySnapshotContentModel,
         config_models.ConfigPropertySnapshotMetadataModel
     }
     self.assertEqual(unimplemented_models, expected_unimplemented)
Ejemplo n.º 2
0
 def test_get_models_which_should_be_exported(self):
     """Ensure that the set of models to export is the set of models with
     export policy CONTAINS_USER_DATA, and that all other models have
     export policy NOT_APPLICABLE.
     """
     all_models = [
         clazz for clazz in self._get_model_classes()
         if not clazz.__name__ in self.BASE_CLASSES
     ]
     models_with_export = (
         takeout_service.get_models_which_should_be_exported())
     for model in all_models:
         export_policy = model.get_export_policy()
         if model in models_with_export:
             self.assertEqual(base_models.EXPORT_POLICY.CONTAINS_USER_DATA,
                              export_policy)
         else:
             self.assertEqual(base_models.EXPORT_POLICY.NOT_APPLICABLE,
                              export_policy)
Ejemplo n.º 3
0
 def test_get_models_which_should_be_exported(self):
     """Ensure that the set of models to export is the set of models with
     export policy CONTAINS_USER_DATA, and that all other models have
     export policy NOT_APPLICABLE.
     """
     all_models = [
         clazz for clazz in test_utils.get_storage_model_classes()
         if (not clazz.__name__ in
             test_utils.BASE_MODEL_CLASSES_WITHOUT_DATA_POLICIES)
     ]
     models_with_export = (
         takeout_service.get_models_which_should_be_exported())
     for model in all_models:
         export_policy = model.get_export_policy()
         if model in models_with_export:
             self.assertIn(base_models.EXPORT_POLICY.EXPORTED,
                           export_policy.values())
         else:
             self.assertNotIn(base_models.EXPORT_POLICY.EXPORTED,
                              export_policy.values())