def test_user_getmedia(conn_args, set_zabbix_version, query_return, mock_login): """ query_submitted = {"params": {"userids": 3}, "jsonrpc": "2.0", "id": 0, "auth": "d4de741ea7cdd434b3ba7b56efa4efaf", "method": "usermedia.get"} """ module_return = [{ "mediatypeid": "1", "mediaid": "1", "severity": "63", "userid": "3", "period": "1-7,00:00-24:00", "sendto": "*****@*****.**", "active": "0", }] # pylint: disable=E8128 query_return({ "jsonrpc": "2.0", "result": [{ "mediaid": "1", "userid": "3", "mediatypeid": "1", "sendto": "*****@*****.**", "active": "0", "severity": "63", "period": "1-7,00:00-24:00", }], "id": 0, }) set_zabbix_version("3.2") assert zabbix.user_getmedia("3", **conn_args) == module_return
def test_user_getmedia(self): ''' query_submitted = {"params": {"userids": 3}, "jsonrpc": "2.0", "id": 0, "auth": "d4de741ea7cdd434b3ba7b56efa4efaf", "method": "usermedia.get"} ''' module_return = [ { "mediatypeid": "1", "mediaid": "1", "severity": "63", "userid": "3", "period": "1-7,00:00-24:00", "sendto": "*****@*****.**", "active": "0" } ] # pylint: disable=E8128 query_return = {"jsonrpc": "2.0", "result": [{"mediaid": "1", "userid": "3", "mediatypeid": "1", "sendto": "*****@*****.**", "active": "0", "severity": "63", "period": "1-7,00:00-24:00"}], "id": 0} with patch.object(zabbix, '_query', return_value=query_return): with patch.object(zabbix, '_login', return_value=CONN_ARGS): self.assertEqual(zabbix.user_getmedia('3', **CONN_ARGS), module_return)