Пример #1
0
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'
Пример #2
0
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"
Пример #3
0
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"
Пример #4
0
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"
Пример #5
0
def test_unicode():
    with vcr.use_cassette('test/fixtures/weather_unicode.yaml'):
        ret = on_message({"text": u"!weather Provençal"}, None)
Пример #6
0
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
Пример #7
0
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)
Пример #8
0
def test_unicode():
    with vcr.use_cassette('test/fixtures/weather_unicode.yaml'):
        ret = on_message({"text": u"!weather Provençal"}, None)
Пример #9
0
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
Пример #10
0
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)