from django.http import HttpResponseRedirect
from django.test import Client
from redir.models import Redirection
import pytest

# >>> from django.test import Client
# >>> c = Client()
# >>> response = c.post('/login/', {'username': 'john', 'password': 'smith'})
# >>> response.status_code
# 200
# >>> response = c.get('/customer/details/')
# >>> response.content
# b'<!DOCTYPE html...'


@pytest.fixture(scope='function')
def redir():
    return Redirection.objects.create(name='test', target="http://test.com/")


@pytest.mark.django_db
def test_valid_redir(redir):
    res = Client().get('/r/{}'.format(redir.name))
    assert isinstance(res, HttpResponseRedirect)


def test_invalid_redir():
    res = Client().get('/trolilol')
    assert not isinstance(res, HttpResponseRedirect)

@@ -125,267 +125,8 @@
 st%0A%0A
-# %3E%3E%3E from django.test import Client%0A# %3E%3E%3E c = Client()%0A# %3E%3E%3E response = c.post('/login/', %7B'username': 'john', 'password': 'smith'%7D)%0A# %3E%3E%3E response.status_code%0A# 200%0A# %3E%3E%3E response = c.get('/customer/details/')%0A# %3E%3E%3E response.content%0A# b'%3C!DOCTYPE html...'%0A%0A
 %0A@py

Remove example code