def test_basic(): server = limbo.FakeServer() with vcr.use_cassette('test/fixtures/weather_basic.yaml'): on_message(msgobj(u"!weather Oahu, HI"), server) attachment = json.loads( server.slack.posted_messages[0][1]['attachments'])[0] assert "Weather for Honolulu, HI" in attachment['pretext'] assert attachment['fields'][0]['value'] == u':sun_small_cloud: 73°f'
def test_basic(): from weather import on_message server = limbo.FakeServer() with vcr.use_cassette("test/fixtures/weather_basic.yaml"): on_message(msgobj(u"!weather Oahu, HI"), server) attachment = json.loads(server.slack.posted_messages[0][1]["attachments"])[0] assert "Weather for Oahu" in attachment["pretext"] assert attachment["fields"][0]["value"] == u":rain_cloud: 75°f"
def test_basic(): from weather import on_message server = limbo.FakeServer() with vcr.use_cassette("test/fixtures/weather_basic.yaml"): on_message(msgobj(u"!weather Oahu, HI"), server) attachment = json.loads( server.slack.posted_messages[0][1]["attachments"])[0] assert "Weather for Oahu" in attachment["pretext"] assert attachment["fields"][0]["value"] == u":rain_cloud: 75°f"
def test_units(monkeypatch): from weather import on_message monkeypatch.setenv("WEATHER_CELSIUS", "yes") server = limbo.FakeServer() #todo record a fixture with correct content for celcius with vcr.use_cassette("test/fixtures/weather_celsius.yaml"): on_message(msgobj(u"!weather Oahu, HI"), server) attachment = json.loads( server.slack.posted_messages[0][1]["attachments"])[0] assert "Weather for Oahu" in attachment["pretext"] assert attachment["fields"][0]["value"] == u":rain_cloud: 75°c"
def test_unicode(): with vcr.use_cassette('test/fixtures/weather_unicode.yaml'): ret = on_message({"text": u"!weather Provençal"}, None)
def test_basic(): with vcr.use_cassette('test/fixtures/weather_basic.yaml'): ret = on_message({"text": u"!weather Oahu, HI"}, None) assert ":cloud: Sat 71" in ret
def test_unicode(): from weather import on_message server = limbo.FakeServer() with vcr.use_cassette("test/fixtures/weather_unicode.yaml"): on_message(msgobj(u"!weather กรุงเทพมหานคร"), server)