Ejemplo n.º 1
0
def test_filter_date_from_invalid(api_client):
    ActivityFactory(action=Activity.CREATE)
    activity = ActivityFactory(action=Activity.UPDATE)
    activity.created = datetime.datetime(2100, 2, 1, tzinfo=tz)
    activity.save()
    response = api_client.get(reverse("snapshot:activity-list"),
                              data={"date_from": "00-01-01"})
    assert response.status_code == status.HTTP_200_OK
    response_json = json.loads(response.rendered_content)
    assert response_json == []
Ejemplo n.º 2
0
def test_filter_date_to(api_client):
    ActivityFactory(action=Activity.CREATE)
    activity = ActivityFactory(action=Activity.UPDATE)
    activity.created = datetime.datetime(2001, 1, 1, tzinfo=tz)
    activity.save()
    response = api_client.get(reverse("snapshot:activity-list"),
                              data={"date_to": "2001-02-01"})
    assert response.status_code == status.HTTP_200_OK
    response_json = json.loads(response.rendered_content)
    assert len(response_json) == 1
    assert_data(activity, response_json[0])