# Path: fossevents/events/services.py
# def get_event_review_url(event):
#     return reverse('events:review', kwargs={'slug': event.slug, 'pk': event.id.hex, 'token': event.auth_token})


import pytest
from django.core.urlresolvers import reverse
from django.utils import timezone
from fossevents.events.services import get_event_review_url
from .. import factories as f
    assert len(response.context['past_events']) == 0

    url = get_event_review_url(event)
    data = {
        'is_approved': 'true',
        'comment': 'Approving event'
    }
    response = client.post(url, data)
    assert response.status_code == 302

    # Event get visible after review
    response = client.get(home_url)
    assert len(response.context['events']) == 0
    assert len(response.context['upcoming_events']) == 1
    assert len(response.context['past_events']) == 0
    assert response.context['upcoming_events'][0].id == event.id


def test_event_review_reject(client):
    event = f.EventFactory(is_published=True)
    user = f.UserFactory(is_moderator=True)
    client.login(user=user)

    home_url = reverse('home')
    response = client.get(home_url)
    assert len(response.context['events']) == 0
    assert len(response.context['upcoming_events']) == 1
    assert len(response.context['past_events']) == 0
    assert response.context['upcoming_events'][0].id == event.id


# Path: fossevents/events/services.py
# def get_event_review_url(event):
#     return reverse('events:review', kwargs={'slug': event.slug, 'pk': event.id.hex, 'token': event.auth_token})


# Path: tests/integrations/test_events_views.py
import pytest
from django.core.urlresolvers import reverse
from django.utils import timezone
from fossevents.events.services import get_event_review_url
from .. import factories as f

    assert len(response.context['past_events']) == 0

    url = get_event_review_url(event)
    data = {
        'is_approved': 'true',
        'comment': 'Approving event'
    }
    response = client.post(url, data)
    assert response.status_code == 302

    # Event get visible after review
    response = client.get(home_url)
    assert len(response.context['events']) == 0
    assert len(response.context['upcoming_events']) == 1
    assert len(response.context['past_events']) == 0
    assert response.context['upcoming_events'][0].id == event.id


def test_event_review_reject(client):
    event = f.EventFactory(is_published=True)
    user = f.UserFactory(is_moderator=True)
    client.login(user=user)

    home_url = reverse('home')
    response = client.get(home_url)
    assert len(response.context['events']) == 0
    assert len(response.context['upcoming_events']) == 1
    assert len(response.context['past_events']) == 0
    assert response.context['upcoming_events'][0].id == event.id


    url = get_event_review_url(event)