MCPcopy Create free account
hub / github.com/chirpstack/chirpstack / test_device_profile

Function test_device_profile

chirpstack/src/api/device_profile.rs:930–1218  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

928
929 #[tokio::test]
930 async fn test_device_profile() {
931 let _guard = test::prepare().await;
932
933 // setup admin user
934 let u = user::User {
935 is_admin: true,
936 is_active: true,
937 email: "admin@admin".into(),
938 email_verified: true,
939 ..Default::default()
940 };
941 let u = user::create(u).await.unwrap();
942
943 // create tenant
944 let t = tenant::create(tenant::Tenant {
945 name: "test-tenant".into(),
946 can_have_gateways: true,
947 max_gateway_count: 10,
948 ..Default::default()
949 })
950 .await
951 .unwrap();
952
953 // create dp vendor
954 let dp_vendor = device_profile::upsert_vendor(device_profile::Vendor {
955 name: "test-vendor".into(),
956 vendor_id: 123,
957 ..Default::default()
958 })
959 .await
960 .unwrap();
961
962 // create dp device
963 let dp_device = device_profile::upsert_device(device_profile::Device {
964 name: "test-device".into(),
965 vendor_id: dp_vendor.id,
966 ..Default::default()
967 })
968 .await
969 .unwrap();
970
971 // create
972 let dp_vendor = device_profile::create(device_profile::DeviceProfile {
973 name: "test-vendor-dp".into(),
974 device_id: Some(dp_device.id),
975 vendor_profile_id: 456,
976 ..Default::default()
977 })
978 .await
979 .unwrap();
980
981 // setup the api
982 let service = DeviceProfile::new(RequestValidator::new());
983
984 // create
985 let create_req = get_request(
986 &u.id,
987 api::CreateDeviceProfileRequest {

Callers

nothing calls this directly

Calls 15

prepareFunction · 0.85
upsert_vendorFunction · 0.85
upsert_deviceFunction · 0.85
unwrapMethod · 0.80
to_stringMethod · 0.80
get_by_profile_idMethod · 0.80
list_adr_algorithmsMethod · 0.80
list_vendorsMethod · 0.80
get_vendorMethod · 0.80
get_deviceMethod · 0.80
delete_deviceMethod · 0.80
delete_vendorMethod · 0.80

Tested by

no test coverage detected