Skip to content

Commit

Permalink
Remove non-compliant stat from push_data (#271)
Browse files Browse the repository at this point in the history
* Remove non-compliant `stat` from `push_data`

* fix test suite
  • Loading branch information
mawdegroot authored Nov 8, 2023
1 parent f1fec7b commit 4f3d053
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 17 deletions.
12 changes: 2 additions & 10 deletions src/protocols/gwmp/hpr_gwmp_worker.erl
Original file line number Diff line number Diff line change
Expand Up @@ -253,17 +253,9 @@ packet_up_to_push_data(Up, GatewayTime) ->
data => base64:encode(hpr_packet_up:payload(Up)),
meta => #{
gateway_id => B58,
gateway_name => Name
gateway_name => Name,
regi => hpr_packet_up:region(Up)
}
},
#{
regi => hpr_packet_up:region(Up),
%% TODO: Add back potential geo stuff
%% CP breaks if {lati, long} are not parseable number
%% inde => Index,
%% lati => Lat,
%% long => Long,
pubk => B58
}
),
{Token, Data}.
Expand Down
11 changes: 4 additions & 7 deletions test/hpr_protocol_gwmp_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -739,14 +739,11 @@ verify_push_data(PacketUp, PushDataBinary) ->
),
<<"gateway_name">> => erlang:list_to_binary(
hpr_utils:gateway_name(PubKeyBin)
)
),
<<"regi">> => erlang:atom_to_binary(
hpr_packet_up:region(PacketUp))
}
}
],
<<"stat">> =>
#{
<<"pubk">> => erlang:list_to_binary(libp2p_crypto:bin_to_b58(PubKeyBin)),
<<"regi">> => erlang:atom_to_binary(hpr_packet_up:region(PacketUp))
}
]
},
?assert(test_utils:match_map(MapFromPacketUp, JsonData)).

0 comments on commit 4f3d053

Please sign in to comment.