Пример #1
0
def test_blob_model_uid_is_unique():
    blob1 = Blob()
    blob2 = Blob()

    blob1.uid = blob2.uid = UID.generate()

    blob1.save()
    blob2.save()
Пример #2
0
def test_blob_model():
    email = '*****@*****.**'

    blob = Blob()

    assert len(blob.uid) > 0
    assert blob.email == ''

    blob.email = email
    blob.save()

    content = blob.to_json()
    assert content['email'] == email

    __blob_model(blob, email)
Пример #3
0
def create(request):
    form = CollectorForm(request.POST)
    if not form.is_valid():
        return HttpResponse(status=400)

    data = form.cleaned_data

    blob = Blob()
    blob.email = data["collectorEmail"]

    blob.save()

    send_email(request, blob)

    return JSONResponse201(blob.to_json())
Пример #4
0
def test_delete_view():
    client = Client()

    email = '*****@*****.**'

    blob = Blob()
    blob.email = email
    blob.uid = 'xYz'
    blob.save()

    # Moved Temporarily
    rc = client.get('/collector/xYz/')
    assert rc.status_code == 302

    # Moved Temporarily
    rc = client.get('/collector/xYz/')
    assert rc.status_code == 302

    Blob.objects.get(email=email)