コード例 #1
0
def test_blob_model():
    email = '[email protected]'

    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)
コード例 #2
0
ファイル: views.py プロジェクト: rentalita/django-collector
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())
コード例 #3
0
def test_delete_view():
    client = Client()

    email = '[email protected]'

    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)
コード例 #4
0
def test_blob_model_uid_is_unique():
    blob1 = Blob()
    blob2 = Blob()

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

    blob1.save()
    blob2.save()