İlk versiyon: MyMach Fleet Intelligence ve yapılandırmalar
This commit is contained in:
42
test_phase3.py
Normal file
42
test_phase3.py
Normal file
@@ -0,0 +1,42 @@
|
||||
print("\n--- FAZ 3 TEST BAŞLIYOR ---")
|
||||
partner = env['res.partner'].create({'name': 'Sürpriz Sürücü'})
|
||||
vehicle = env['fleet.vehicle'].search([], limit=1)
|
||||
vehicle.driver_id = partner.id
|
||||
|
||||
# 1. Sözleşme Yasaklı İken
|
||||
contract = env['mymach.fleet.contract'].create({
|
||||
'name': 'TEST-FAZ3',
|
||||
'driver_id': partner.id,
|
||||
'personal_use_policy': 'forbidden',
|
||||
})
|
||||
|
||||
log = env['mymach.fleet.security.log'].create({
|
||||
'name': 'Test GPS Log',
|
||||
'vehicle_id': vehicle.id,
|
||||
'status': 'exception'
|
||||
})
|
||||
|
||||
wizard = env['mymach.fleet.route.exception.wizard'].create({
|
||||
'log_id': log.id,
|
||||
'vehicle_id': vehicle.id,
|
||||
'exception_type': 'personal',
|
||||
'description': 'Haftasonu Piknik',
|
||||
'estimated_cost': 500.0
|
||||
})
|
||||
|
||||
print("TEST_RESULT_START")
|
||||
try:
|
||||
wizard.action_confirm()
|
||||
print("HATA: Yasaklı sözleşmeye rağmen onaylandı!")
|
||||
except Exception as e:
|
||||
print("BAŞARILI: Sözleşme yasağı devreye girdi ve engelledi. Hata Mesajı:", str(e))
|
||||
|
||||
# 2. Sözleşme İzinli İken
|
||||
contract.personal_use_policy = 'allowed'
|
||||
wizard.action_confirm()
|
||||
print("BAŞARILI: İzinli sözleşme onaylandı.")
|
||||
print("Log Kesinti Tutarı (Beklenen 500.0):", log.deduction_amount)
|
||||
print("Log Çözüldü Mü (Beklenen True):", log.is_resolved)
|
||||
print("TEST_RESULT_END")
|
||||
print("--- FAZ 3 TEST BİTTİ ---\n")
|
||||
env.cr.rollback()
|
||||
Reference in New Issue
Block a user