def test_data_sharing_consent_requested(self, mock_get_ec):
     """
     Test that we correctly check whether data sharing consent is requested.
     """
     request = mock.MagicMock(session={"partial_pipeline": "thing"})
     mock_get_ec.return_value = mock.MagicMock(requests_data_sharing_consent=True)
     self.assertTrue(data_sharing_consent_requested(request))
     mock_get_ec.return_value = mock.MagicMock(requests_data_sharing_consent=False)
     self.assertFalse(data_sharing_consent_requested(request))
     mock_get_ec.return_value = None
     self.assertFalse(data_sharing_consent_requested(request))
     request = mock.MagicMock(session={})
     self.assertFalse(data_sharing_consent_requested(request))
 def test_data_sharing_consent_requested(self, mock_get_ec):
     """
     Test that we correctly check whether data sharing consent is requested.
     """
     request = mock.MagicMock(session={'partial_pipeline': 'thing'})
     mock_get_ec.return_value = mock.MagicMock(
         requests_data_sharing_consent=True)
     self.assertTrue(data_sharing_consent_requested(request))
     mock_get_ec.return_value = mock.MagicMock(
         requests_data_sharing_consent=False)
     self.assertFalse(data_sharing_consent_requested(request))
     mock_get_ec.return_value = None
     self.assertFalse(data_sharing_consent_requested(request))
     request = mock.MagicMock(session={})
     self.assertFalse(data_sharing_consent_requested(request))
 def test_utils_with_enterprise_disabled(self, mock_enterprise_enabled):
     """
     Test that the enterprise app not being available causes
     the utilities to return the expected default values.
     """
     mock_enterprise_enabled.return_value = False
     self.assertFalse(data_sharing_consent_requested(None))
     self.assertFalse(data_sharing_consent_required_at_login(None))
     self.assertEqual(data_sharing_consent_requirement_at_login(None), None)
     self.assertEqual(insert_enterprise_fields(None, None), None)
     self.assertEqual(insert_enterprise_pipeline_elements(None), None)
 def test_utils_with_enterprise_disabled(self, mock_enterprise_enabled):
     """
     Test that the enterprise app not being available causes
     the utilities to return the expected default values.
     """
     mock_enterprise_enabled.return_value = False
     self.assertFalse(data_sharing_consent_requested(None))
     self.assertFalse(data_sharing_consent_required_at_login(None))
     self.assertEqual(data_sharing_consent_requirement_at_login(None), None)
     self.assertEqual(insert_enterprise_fields(None, None), None)
     self.assertEqual(insert_enterprise_pipeline_elements(None), None)