def test_gabi_authorized_users_exceed(self, mock_request, get_gabi_instances, oc_version, secret_read, get_settings): expirationDate = date.today() + timedelta(days=(gabi_u.EXPIRATION_MAX + 1)) get_gabi_instances.return_value = mock_get_gabi_instances( expirationDate) mock_request.side_effect = apply_request with self.assertRaises(RunnerException): gabi_u.run(dry_run=False)
def test_gabi_authorized_users_exist(self, mock_apply, sha, mock_request, get_gabi_instances, oc_version, secret_read, get_settings): # pylint: disable=no-self-use expirationDate = date.today() get_gabi_instances.return_value = \ mock_get_gabi_instances(expirationDate) mock_request.side_effect = delete_request sha.return_value = 'abc' gabi_u.run(dry_run=False) mock_apply.assert_not_called()
def test_gabi_authorized_users_apply(self, mock_apply, mock_request, get_gabi_instances, oc_version, secret_read, get_settings): expirationDate = date.today() get_gabi_instances.return_value = \ mock_get_gabi_instances(expirationDate) mock_request.side_effect = apply_request gabi_u.run(dry_run=False) expected = OR(apply['desired'], gabi_u.QONTRACT_INTEGRATION, gabi_u.QONTRACT_INTEGRATION_VERSION) args, _ = mock_apply.call_args self.assertEqual(args[5], expected)
def test_gabi_authorized_users_expire(self, mock_apply, mock_request, get_gabi_instances, oc_version, secret_read, get_settings): # pylint: disable=no-self-use expirationDate = date.today() - timedelta(days=1) get_gabi_instances.return_value = \ mock_get_gabi_instances(expirationDate) mock_request.side_effect = delete_request gabi_u.run(dry_run=False) expected = OR(delete['desired'], gabi_u.QONTRACT_INTEGRATION, gabi_u.QONTRACT_INTEGRATION_VERSION) args, _ = mock_apply.call_args self.assertEqual(args[5], expected)