You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

279 lines
10 KiB
Python

from django.test import TestCase
# Create your tests here.
l1 = [
{
"video_hash": "vbhdrbvcw",
"record_time": "2022-07-14 15:43:25",
"police_id": "8888888",
"event_type": "卡车",
"is_violation": False,
"small_image": "http://192.168.10.28:8000/media/images/B2_006.png",
"relative_time": 6.0,
"video_dir": "http://192.168.10.28:8000/media/videos/B2.mp4",
"car_number": "赣A·98980",
"ai_analysis": "",
"add_time": "2023-06-12 09:17:45",
"update_time": "2023-06-27 02:36:51",
"is_display": True
},
{
"video_hash": "vbhdrbvcw",
"record_time": "2022-07-14 15:43:24",
"police_id": "8888888",
"event_type": "卡车",
"is_violation": True,
"small_image": "http://192.168.10.28:8000/media/images/B2_004.png",
"relative_time": 4.0,
"video_dir": "http://192.168.10.28:8000/media/videos/B2.mp4",
"car_number": "赣A·98980",
"ai_analysis": "",
"add_time": "2023-06-12 09:16:41",
"update_time": "2023-06-27 02:36:51",
"is_display": True
},
{
"video_hash": "vbhdrbvcw",
"record_time": "2023-05-14 17:27:40",
"police_id": "",
"event_type": "推搡",
"is_violation": True,
"small_image": "http://192.168.10.28:8000/media/images/shoving_005_1.png",
"relative_time": 9.0,
"video_dir": "http://192.168.10.28:8000/media/videos/shoving.mp4",
"car_number": "",
"ai_analysis": "",
"add_time": "2023-06-12 07:13:24",
"update_time": "2023-06-27 02:36:51",
"is_display": True
},
{
"video_hash": "vbhdrbvcw",
"record_time": "2023-05-14 17:27:40",
"police_id": "",
"event_type": "推搡",
"is_violation": True,
"small_image": "http://192.168.10.28:8000/media/images/shoving_009_1.png",
"relative_time": 9.0,
"video_dir": "http://192.168.10.28:8000/media/videos/shoving.mp4",
"car_number": "",
"ai_analysis": "",
"add_time": "2023-06-12 07:13:19",
"update_time": "2023-06-27 02:36:52",
"is_display": True
},
{
"video_hash": "vbhdrbvcw",
"record_time": "2023-05-14 17:27:40",
"police_id": "",
"event_type": "推搡",
"is_violation": True,
"small_image": "http://192.168.10.28:8000/media/images/shoving_009.png",
"relative_time": 9.0,
"video_dir": "http://192.168.10.28:8000/media/videos/shoving.mp4",
"car_number": "",
"ai_analysis": "",
"add_time": "2023-06-12 07:12:34",
"update_time": "2023-06-27 02:36:52",
"is_display": True
},
{
"video_hash": "vbhdrbvcw",
"record_time": "2023-05-14 17:27:40",
"police_id": "",
"event_type": "推搡",
"is_violation": True,
"small_image": "http://192.168.10.28:8000/media/images/shoving_005.png",
"relative_time": 5.0,
"video_dir": "http://192.168.10.28:8000/media/videos/shoving.mp4",
"car_number": "",
"ai_analysis": "",
"add_time": "2023-06-12 07:10:03",
"update_time": "2023-06-27 02:36:52",
"is_display": True
},
{
"video_hash": "vbhdrbvcw",
"record_time": "2022-07-14 17:27:40",
"police_id": "8888888",
"event_type": "未戴头盔",
"is_violation": True,
"small_image": "http://192.168.10.28:8000/media/images/G2_018_1.png",
"relative_time": 18.0,
"video_dir": "http://192.168.10.28:8000/media/videos/G2.MP4",
"car_number": "",
"ai_analysis": "",
"add_time": "2023-06-12 06:53:50",
"update_time": "2023-06-27 02:36:52",
"is_display": True
},
{
"video_hash": "vbhdrbvcw",
"record_time": "2022-07-14 17:27:40",
"police_id": "",
"event_type": "未戴头盔",
"is_violation": True,
"small_image": "http://192.168.10.28:8000/media/images/G2_018.png",
"relative_time": 18.0,
"video_dir": "http://192.168.10.28:8000/media/videos/G2.MP4",
"car_number": "",
"ai_analysis": "",
"add_time": "2023-06-12 06:53:26",
"update_time": "2023-06-27 02:36:52",
"is_display": True
},
{
"video_hash": "vbhdrbvcw",
"record_time": "2022-07-15 07:42:48",
"police_id": "0890151",
"event_type": "未戴头盔以及载人",
"is_violation": True,
"small_image": "http://192.168.10.28:8000/media/images/G1_024_1.png",
"relative_time": 24.0,
"video_dir": "http://192.168.10.28:8000/media/videos/G1.MP4",
"car_number": "",
"ai_analysis": "",
"add_time": "2023-06-12 06:52:12",
"update_time": "2023-06-27 02:36:52",
"is_display": True
},
{
"video_hash": "vbhdrbvcw",
"record_time": "2022-07-15 07:42:48",
"police_id": "0890151",
"event_type": "未戴头盔以及载人",
"is_violation": True,
"small_image": "http://192.168.10.28:8000/media/images/G1_024.png",
"relative_time": 24.0,
"video_dir": "http://192.168.10.28:8000/media/videos/G1.MP4",
"car_number": "",
"ai_analysis": "",
"add_time": "2023-06-12 06:51:33",
"update_time": "2023-06-27 02:36:52",
"is_display": True
},
{
"video_hash": "vbhdrbvcw",
"record_time": "2022-07-15 07:42:46",
"police_id": "0890151",
"event_type": "未戴头盔以及载人",
"is_violation": True,
"small_image": "http://192.168.10.28:8000/media/images/G1_022.png",
"relative_time": 22.0,
"video_dir": "http://192.168.10.28:8000/media/videos/G1.MP4",
"car_number": "",
"ai_analysis": "",
"add_time": "2023-06-12 06:50:53",
"update_time": "2023-06-27 02:36:52",
"is_display": True
},
{
"video_hash": "vbhdrbvcw",
"record_time": "2022-07-15 07:42:28",
"police_id": "0890151",
"event_type": "未戴头盔以及载人",
"is_violation": True,
"small_image": "http://192.168.10.28:8000/media/images/G1_004.png",
"relative_time": 4.0,
"video_dir": "http://192.168.10.28:8000/media/videos/G1.MP4",
"car_number": "",
"ai_analysis": "",
"add_time": "2023-06-12 06:49:36",
"update_time": "2023-06-27 02:36:52",
"is_display": True
},
{
"video_hash": "vbhdrbvcw",
"record_time": "2022-07-15 07:44:05",
"police_id": "0890151",
"event_type": "未戴头盔",
"is_violation": True,
"small_image": "http://192.168.10.28:8000/media/images/G1_141_1.png",
"relative_time": 101.0,
"video_dir": "http://192.168.10.28:8000/media/videos/G1.MP4",
"car_number": "",
"ai_analysis": "",
"add_time": "2023-06-12 06:48:34",
"update_time": "2023-06-27 02:36:52",
"is_display": True
},
{
"video_hash": "vbhdrbvcw",
"record_time": "2022-07-15 07:44:05",
"police_id": "0890151",
"event_type": "未戴头盔",
"is_violation": True,
"small_image": "http://192.168.10.28:8000/media/images/G1_141.jpg",
"relative_time": 141.0,
"video_dir": "http://192.168.10.28:8000/media/videos/G1.MP4",
"car_number": "",
"ai_analysis": "",
"add_time": "2023-06-12 06:46:45",
"update_time": "2023-06-27 02:36:52",
"is_display": True
},
{
"video_hash": "vbhdrbvcw",
"record_time": "2022-07-15 07:42:26",
"police_id": "0890151",
"event_type": "未戴头盔以及载人",
"is_violation": True,
"small_image": "http://192.168.10.28:8000/media/images/G1_002.png",
"relative_time": 2.0,
"video_dir": "http://192.168.10.28:8000/media/videos/G1.MP4",
"car_number": "",
"ai_analysis": "",
"add_time": "2023-06-12 06:45:39",
"update_time": "2023-06-27 02:36:52",
"is_display": True
},
{
"video_hash": "vbhdrbvcw",
"record_time": "2022-07-15 10:36:13",
"police_id": "6666666",
"event_type": "未戴头盔",
"is_violation": True,
"small_image": "http://192.168.10.28:8000/media/images/B1_056.png",
"relative_time": 56.0,
"video_dir": "http://192.168.10.28:8000/media/videos/B1.MP4",
"car_number": "",
"ai_analysis": "",
"add_time": "2023-06-12 06:44:04",
"update_time": "2023-06-27 02:36:52",
"is_display": True
},
{
"video_hash": "vbhdrbvcw",
"record_time": "2022-07-15 10:36:13",
"police_id": "6666666",
"event_type": "未戴头盔",
"is_violation": True,
"small_image": "http://192.168.10.28:8000/media/images/056.png",
"relative_time": 56.0,
"video_dir": "http://192.168.10.28:8000/media/videos/B1.MP4",
"car_number": "",
"ai_analysis": "",
"add_time": "2023-06-12 06:18:40",
"update_time": "2023-06-27 02:36:52",
"is_display": True
}
]
l2 = []
from app.models import TP
def import_data(data):
try:
for item in data:
TP.objects.create(**item)
return
except Exception as e:
print(e)
return
if __name__ == '__main__':
import_data(l1)