

@run_only_if_pymongo_is_available
@patch('pymongo.Connection')
@patch.object(Collector, 'publish')
def test_should_publish_nested_keys_for_server_stats(self, publish_mock, connector_mock):
    data = {
        'more_keys': {
            'nested_key': 1,
        },
        'key': 2,
        'string': 'str',
    }
    self._annotate_connection(connector_mock, data)
    self.collector.collect()
    publish_mock.connection.db.command.assert_called_once_with('serverStatus')
    self.assertPublishedMany(publish_mock, {
        'more_keys.nested_key': 1,
        'key': 2,
    })

dataset/ETHPy150Open BrightcoveOS/Diamond/src/collectors/mongodb/test/testmongodb.py TestMongoDBCollector.test_should_publish_nested_keys_for_server_stats/VarMisuse@78/124 `self`->`publish_mock`