Ejemplo n.º 1
0
 def test_all_users_privileged(self):
   """Test when all_users_privileged is set."""
   test_helpers.patch(self, ['config.local_config.AuthConfig'])
   self.mock.AuthConfig.return_value = mock_config.MockConfig({
       'all_users_privileged': True,
   })
   self.assertTrue(access._is_privileged_user('*****@*****.**'))
Ejemplo n.º 2
0
 def test_global(self):
     """Ensure it returns True if an email is permitted globally."""
     self.mock.get_value.return_value = self._FAKE_CONFIG
     self.assertTrue(access._is_privileged_user('*****@*****.**'))
     self.mock.get_value.assert_has_calls([mock.call('privileged_users')])
Ejemplo n.º 3
0
 def test_none(self):
     """Ensure it returns False when config is invalid."""
     self.mock.get_value.return_value = None
     self.assertFalse(access._is_privileged_user('test'))
     self.mock.get_value.assert_has_calls([mock.call('privileged_users')])