Exemplo n.º 1
0
    def test_bans_error(self):
        """
        tests fishbans with a HTTP error
        """
        responses.add(responses.GET, 'http://api.fishbans.com/stats/notch/', status=404)

        assert fishbans(test_user, DummyBot).startswith(reply_error)
Exemplo n.º 2
0
    def test_bans_none(self):
        """
        tests fishbans with a successful API response having no bans
        """
        responses.add(responses.GET, 'http://api.fishbans.com/stats/notch/', body=test_api_none)

        assert fishbans(test_user, DummyBot) == bans_reply_none
Exemplo n.º 3
0
    def test_bans_failed(self):
        """
        tests fishbans with a failed API response
        """
        responses.add(responses.GET, 'http://api.fishbans.com/stats/notch/', body=test_api_failed)

        assert fishbans(test_user, DummyBot) == reply_failed
Exemplo n.º 4
0
    def test_bans_error(self):
        """
        tests fishbans with a HTTP error
        """
        responses.add(responses.GET,
                      'http://api.fishbans.com/stats/notch/',
                      status=404)

        assert fishbans(test_user, DummyBot).startswith(reply_error)
Exemplo n.º 5
0
    def test_bans_none(self):
        """
        tests fishbans with a successful API response having no bans
        """
        responses.add(responses.GET,
                      'http://api.fishbans.com/stats/notch/',
                      body=test_api_none)

        assert fishbans(test_user, DummyBot) == bans_reply_none
Exemplo n.º 6
0
    def test_bans_failed(self):
        """
        tests fishbans with a failed API response
        """
        responses.add(responses.GET,
                      'http://api.fishbans.com/stats/notch/',
                      body=test_api_failed)

        assert fishbans(test_user, DummyBot) == reply_failed
Exemplo n.º 7
0
def test_bans_none(monkeypatch):
    """ tests fishbans with a successful API response having no bans
    """

    def fake_http(url):
        assert url == "http://api.fishbans.com/stats/notch/"
        return json.loads(test_api_none)

    monkeypatch.setattr(http, "get_json", fake_http)

    assert fishbans(test_user) == bans_reply_none
Exemplo n.º 8
0
def test_bans_failed(monkeypatch):
    """ tests fishbans with a failed API response
    """

    def fake_http(url):
        assert url == "http://api.fishbans.com/stats/notch/"
        return json.loads(test_api_failed)

    monkeypatch.setattr(http, "get_json", fake_http)

    assert fishbans(test_user) == bans_reply_failed