Beispiel #1
0
def redirect(request, viewer, key):
    new = Token(data=[viewer.file.id, key])
    new.save()
    url = reverse('files.serve', args=[viewer, key])
    url = urlparams(url, token=new.token)
    return http.HttpResponseRedirect(url)
 def test_token_bad_ip_invalid(self):
     new = Token(data='127.0.0.1')
     new.save()
     assert not Token.pop(new.token, '255.255.255.0')
     assert Token.pop(new.token, '127.0.0.1')
Beispiel #3
0
def redirect(request, viewer, key):
    new = Token(data=[viewer.file.id, key])
    new.save()
    url = reverse('files.serve', args=[viewer, key])
    url = urlparams(url, token=new.token)
    return http.HttpResponseRedirect(url)
 def test_token_valid(self):
     new = Token()
     new.save()
     assert Token.valid(new.token)
 def test_token_ip(self):
     new = Token(data='127.0.0.1')
     new.save()
     assert Token.valid(new.token, '127.0.0.1')
 def test_token_pop(self):
     new = Token()
     new.save()
     assert Token.pop(new.token)
     assert not Token.pop(new.token)
 def test_token_bad_ip_invalid(self):
     new = Token(data='127.0.0.1')
     new.save()
     assert not Token.pop(new.token, '255.255.255.0')
     assert Token.pop(new.token, '127.0.0.1')
 def test_token_ip(self):
     new = Token(data='127.0.0.1')
     new.save()
     assert Token.valid(new.token, '127.0.0.1')
 def test_token_valid(self):
     new = Token()
     new.save()
     assert Token.valid(new.token)
 def test_token_pop(self):
     new = Token()
     new.save()
     assert Token.pop(new.token)
     assert not Token.pop(new.token)