def _get_count(self): """Get the number of queries by counting the current number of entries in db.system.profile and substracting the queries issued by this context. In fact everytime this is called, 1 query is issued so we need to balance that """ count = count_documents(self.db.system.profile, self._ignored_query) - self._ctx_query_counter self._ctx_query_counter += 1 # Account for the query we just issued to gather the information return count
def _test_success(self, message): assert count_documents(self.db_collection, {'text': { '$exists': True }}) == 0 data = { "client_msg_id": "0ebe05ca-a41f-4174-8d19-0a3e34b0e0d5", "suppress_notification": False, "text": message, "user": "******", "team": "T37A8AJBZ", "user_team": "T37A8AJBZ", "source_team": "T37A8AJBZ", "channel": "C4V5A0E3W", "event_ts": "1572364286.379400", "ts": "1572364286.379400" } reply = message_event(event=data) assert reply, "Reply is empty" assert count_documents(self.db_collection, {'text': { '$exists': True }}) == 1
def issue_1_count_query(): count_documents(collection, {})