Ejemplo n.º 1
0
    def test_count_failed(self):
        """
        tests bancount with a failed API response
        """
        responses.add(responses.GET, 'http://api.fishbans.com/stats/notch/', body=test_api_failed)

        assert bancount(test_user, DummyBot) == reply_failed
Ejemplo n.º 2
0
    def test_count(self):
        """
        tests bancount with a successful API response having multiple bans
        """
        responses.add(responses.GET, 'http://api.fishbans.com/stats/notch/', body=test_api)

        assert bancount(test_user, DummyBot) == count_reply
Ejemplo n.º 3
0
    def test_count_error(self):
        """
        tests bancount with a HTTP error
        """
        responses.add(responses.GET, 'http://api.fishbans.com/stats/notch/', status=404)

        assert bancount(test_user, DummyBot).startswith(reply_error)
Ejemplo n.º 4
0
def test_count_failed(monkeypatch):
    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 bancount(test_user) == count_reply_failed
Ejemplo n.º 5
0
    def test_count(self):
        """
        tests bancount with a successful API response having multiple bans
        """
        responses.add(responses.GET,
                      'http://api.fishbans.com/stats/notch/',
                      body=test_api)

        assert bancount(test_user, DummyBot) == count_reply
Ejemplo n.º 6
0
    def test_count_error(self):
        """
        tests bancount with a HTTP error
        """
        responses.add(responses.GET,
                      'http://api.fishbans.com/stats/notch/',
                      status=404)

        assert bancount(test_user, DummyBot).startswith(reply_error)
Ejemplo n.º 7
0
    def test_count_failed(self):
        """
        tests bancount with a failed API response
        """
        responses.add(responses.GET,
                      'http://api.fishbans.com/stats/notch/',
                      body=test_api_failed)

        assert bancount(test_user, DummyBot) == reply_failed