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)
    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
    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
Exemple #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)
Exemple #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
Exemple #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
Exemple #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
Exemple #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