Пример #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)
Пример #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
Пример #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
Пример #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)
Пример #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
Пример #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
Пример #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
Пример #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