def test_bootstrap_datastore_yaml(self, mock_importyaml): """Tests bootstrap_datastore_yaml.""" bootstrap.bootstrap_datastore_yaml(user_email='foo') yaml_file_to_string = open(os.path.join( os.path.dirname(__file__), 'bootstrap.yaml')).read() mock_importyaml.assert_called_once_with( yaml_file_to_string, 'foo', True)
def test_manage_task_being_called(self, mock_importyaml): """Tests that the manage_task decorator is doing its task management.""" del mock_importyaml # Unused. bootstrap.bootstrap_datastore_yaml(user_email='foo') expected_model = bootstrap_status_model.BootstrapStatus.get_by_id( 'bootstrap_datastore_yaml') self.assertEqual( expected_model.description, bootstrap._TASK_DESCRIPTIONS['bootstrap_datastore_yaml']) self.assertTrue(expected_model.success) self.assertTrue(expected_model.timestamp < datetime.datetime.utcnow())