def test_metasmoke(): chatcommunicate.parse_room_config("test/test_rooms.yml") orig_tell_rooms_with = chatcommunicate.tell_rooms_with chatcommunicate.tell_rooms_with = dummy_tell_rooms_with msg = Fake({ "owner": { "name": "ArtOfCode", "id": 121520, "is_moderator": False }, "room": { "id": 11540, "_client": { "host": "stackexchange.com" } }, "_client": { "host": "stackexchange.com" } }) msg_source = "metasmoke is {}. Current failure count: {} " + "({id})".format( id=GlobalVars.location) chatcommands.metasmoke(original_msg=msg, alias_used="ms-up") assert GlobalVars.MSStatus.is_up() chatcommands.metasmoke(original_msg=msg, alias_used="ms-down") assert GlobalVars.MSStatus.is_down() GlobalVars.MSStatus.reset_ms_status() assert chatcommands.metasmoke(original_msg=msg, alias_used="ms-status") == msg_source.format( "up", 0) chatcommunicate.tell_rooms_with = orig_tell_rooms_with
def test_metasmoke(): msg = Fake({ "owner": { "name": "ArtOfCode", "id": 121520, "is_moderator": False }, "room": { "id": 11540, "_client": { "host": "stackexchange.com" } }, "_client": { "host": "stackexchange.com" } }) msg_source = "metasmoke is {}. Current failure count: {}" assert chatcommands.metasmoke(original_msg=msg, alias_used="ms-up") == "metasmoke is now considered up." assert chatcommands.metasmoke(original_msg=msg, alias_used="ms-status") == msg_source.format("up", 0) assert chatcommands.metasmoke(original_msg=msg, alias_used="ms-down") == "metasmoke is now considered down." assert chatcommands.metasmoke(original_msg=msg, alias_used="ms-status") == msg_source.format("down", 999) assert chatcommands.metasmoke(original_msg=msg, alias_used="ms-up") == "metasmoke is now considered up." assert chatcommands.metasmoke(original_msg=msg, alias_used="ms-status") == msg_source.format("up", 0)
def test_metasmoke(): msg = Fake({ "owner": { "name": "ArtOfCode", "id": 121520, "is_moderator": False }, "room": { "id": 11540, "_client": { "host": "stackexchange.com" } }, "_client": { "host": "stackexchange.com" } }) msg_source = "metasmoke is {}. Current failure count: {} " + "({id})".format(id=GlobalVars.location) assert chatcommands.metasmoke(original_msg=msg, alias_used="ms-up") == "metasmoke is now considered up." assert chatcommands.metasmoke(original_msg=msg, alias_used="ms-status") == msg_source.format("up", 0) assert chatcommands.metasmoke(original_msg=msg, alias_used="ms-down") == "metasmoke is now considered down." assert chatcommands.metasmoke(original_msg=msg, alias_used="ms-status") == msg_source.format("down", 999) assert chatcommands.metasmoke(original_msg=msg, alias_used="ms-up") == "metasmoke is now considered up." assert chatcommands.metasmoke(original_msg=msg, alias_used="ms-status") == msg_source.format("up", 0)
def test_metasmoke(): msg = Fake({ "owner": { "name": "El'endia Starman", "id": 1, "is_moderator": False }, "room": { "id": 11540, "_client": { "host": "stackexchange.com" } }, "_client": { "host": "stackexchange.com" } }) msg_source = "metasmoke is {}. Current failure count: {}" assert chatcommands.metasmoke( original_msg=msg, alias_used="ms-up") == "metasmoke is now considered up." assert chatcommands.metasmoke(original_msg=msg, alias_used="ms-status") == msg_source.format( "up", 0) assert chatcommands.metasmoke( original_msg=msg, alias_used="ms-down") == "metasmoke is now considered down." assert chatcommands.metasmoke(original_msg=msg, alias_used="ms-status") == msg_source.format( "down", 999) assert chatcommands.metasmoke( original_msg=msg, alias_used="ms-up") == "metasmoke is now considered up." assert chatcommands.metasmoke(original_msg=msg, alias_used="ms-status") == msg_source.format( "up", 0)