Ejemplo n.º 1
0
def test_start_end_correct():
    assert StartCallRecordFactory()
    assert EndCallRecordFactory(timestamp=timezone.now() + datetime.timedelta(days=1))
Ejemplo n.º 2
0
def test_end_date_before_start():
    assert EndCallRecordFactory()
    with pytest.raises(InvalidDateIntervalError):
        StartCallRecordFactory(timestamp=timezone.now() + datetime.timedelta(days=1))
Ejemplo n.º 3
0
def test_start_date_after_end():
    assert StartCallRecordFactory(timestamp=timezone.now() + datetime.timedelta(days=1))
    with pytest.raises(InvalidDateIntervalError):
        EndCallRecordFactory()
Ejemplo n.º 4
0
def test_invalid_phone_number_long():
    with pytest.raises(ValidationError):
        StartCallRecordFactory(source="123456789123456789")
Ejemplo n.º 5
0
def test_duplicate_start_call_id():
    assert StartCallRecordFactory(call_id=1)
    with pytest.raises(CallIdDuplicationError):
        StartCallRecordFactory(call_id=1)
Ejemplo n.º 6
0
def test_invalid_phone_number_alpha():
    with pytest.raises(ValidationError):
        StartCallRecordFactory(source="this is not a number")
Ejemplo n.º 7
0
def test_invalid_phone_number_short():
    with pytest.raises(ValidationError):
        StartCallRecordFactory(source="123")
Ejemplo n.º 8
0
def test_start():
    assert StartCallRecordFactory()
Ejemplo n.º 9
0
def test_start_no_phone():
    with pytest.raises(StartEndError):
        StartCallRecordFactory(source=None, destination=None)
Ejemplo n.º 10
0
def test_start_destination():
    with pytest.raises(StartEndError):
        StartCallRecordFactory(destination=None)
Ejemplo n.º 11
0
def test_start_source():
    with pytest.raises(StartEndError):
        StartCallRecordFactory(source=None)
Ejemplo n.º 12
0
def test_source_eq_destination():
    with pytest.raises(SourceEqualsDestinationError):
        StartCallRecordFactory(source="1111111111", destination="1111111111")