Skip to content

Commit

Permalink
api: Make insert event never return anything
Browse files Browse the repository at this point in the history
This feature has not been used since our very old replace_last code
before heartbeats were a thing.
  • Loading branch information
johan-bjareholt committed Mar 15, 2021
1 parent 5950a82 commit fe6b0b3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion aw_server/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def create_events(self, bucket_id: str, events: List[Event]) -> Optional[Event]:
"""Create events for a bucket. Can handle both single events and multiple ones.
Returns the inserted event when a single event was inserted, otherwise None."""
return self.db[bucket_id].insert(events[0] if len(events) == 1 else events)
return self.db[bucket_id].insert(events)

@check_bucket_exists
def get_eventcount(
Expand Down
6 changes: 3 additions & 3 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,9 @@ def test_list_buckets(aw_client, bucket):

def test_send_event(aw_client, bucket):
event = Event(timestamp=datetime.now(tz=timezone.utc), data={"label": "test"})
recv_event = aw_client.send_event(bucket, event)
assert recv_event.id is not None
assert recv_event == event
aw_client.send_event(bucket, event)
recv_events = aw_client.get_events(bucket, limit=1)
assert recv_events == [event]


def test_send_events(aw_client, bucket):
Expand Down

0 comments on commit fe6b0b3

Please sign in to comment.