コード例 #1
0
def test_get_minute_fee_is_deleted(client):
    fee = MinuteFeeFactory()
    client.delete(f'/v1/bill/fee/minute/{fee.id}/')

    rv = client.get(f'/v1/bill/fee/minute/{fee.id}/')

    assert rv.status_code == 404
コード例 #2
0
def test_get_not_existing_model_minute_fee():
    minute_fee = MinuteFeeFactory()

    try:
        minute_fee = MinuteFee.objects.get(pk=minute_fee.pk + 1)
    except models.ObjectDoesNotExist:
        minute_fee = None

    assert minute_fee is None
コード例 #3
0
def test_fail_put_minute_fee(client):
    fee = MinuteFeeFactory()

    mimetype = 'application/json'
    headers = {'Content-Type': mimetype, 'Accept': mimetype}
    data = {'price': 0.36}

    rv = client.put(f'/v1/bill/fee/minute/{fee.id}/',
                    data=data,
                    headers=headers)
    assert rv.status_code == 405
コード例 #4
0
def test_fail_get_year_future_bill(client):
    MinuteFeeFactory()
    FixedFeeFactory()
    mimetype = 'application/json'
    headers = {'Content-Type': mimetype, 'Accept': mimetype}
    data_s = {
        'id': 1,
        'source': 10999995555,
        'destination': 10955559999,
        'timestamp': '2017-12-12T15:07:58Z',
        'type': 'start',
    }

    data_e = {'id': 1, 'timestamp': '2017-12-12T17:07:58Z', 'type': 'end'}
    client.post('/v1/call/', data=data_s, headers=headers)
    client.post('/v1/call/', data=data_e, headers=headers)
    rv = client.get("/v1/bill/10999995555/2020/")
    assert rv.status_code == 400
    assert rv.json is not None
コード例 #5
0
def test_get_last_bill(client):
    MinuteFeeFactory()
    FixedFeeFactory()
    mimetype = 'application/json'
    headers = {'Content-Type': mimetype, 'Accept': mimetype}
    data_s = {
        'id': 1,
        'source': 10999995555,
        'destination': 10955559999,
        'timestamp':
        f'{datetime.today().year}-{datetime.today().month - 1}-05T15:07:58Z',
        'type': 'start',
    }

    data_e = {
        'id': 1,
        'timestamp':
        f'{datetime.today().year}-{datetime.today().month - 1}-12T17:07:58Z',
        'type': 'end'
    }
    client.post('/v1/call/', data=data_s, headers=headers)
    client.post('/v1/call/', data=data_e, headers=headers)
    rv = client.get("/v1/bill/10999995555/")
    assert rv.status_code == 200
コード例 #6
0
def test_delete_minute_fee(client):
    fee = MinuteFeeFactory()
    rv = client.delete(f'/v1/bill/fee/minute/{fee.id}/')

    assert rv.status_code == 204
コード例 #7
0
def test_get_minute_fee_created():
    minute_fee = MinuteFeeFactory()
    fee = MinuteFee.objects.get(pk=minute_fee.pk)

    assert minute_fee == fee