# MIT License
#
# Copyright (c) 2017 Ricardo Velhote
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
import unittest
from bitcoin import Bitstamp


class BitstampTest(unittest.TestCase):
    def test_valid_request(self):
        """Test that everything goes according to the plan"""
        exchange = Bitstamp("eur")
        result = exchange.query()

        self.assertIsNotNone(result)
        self.assertIn("last", result)

    def test_invalid_api_url(self):
        """Test with an invalid URL (e.g. the domain does not exist)"""
        exchange = Bitstamp("inv")
        result = exchange.query()
        self.assertIsNone(result)

    def test_http_status_error(self):
        """Test with an URL that does not exist and the server replies with a status code"""
        exchange = Bitstamp("404")
        result = exchange.query()
        self.assertIsNone(result)

@@ -1114,45 +1114,555 @@
 ort 
-unittest%0Afrom bitcoin import Bitstamp
+gi%0Aimport os%0Aimport unittest%0A%0Agi.require_version('AppIndicator3', '0.1')%0A%0Afrom bitcoin import Bitstamp%0Afrom bitcoin import QueryLoop%0A%0Afrom gi.repository import AppIndicator3 as appindicator%0A%0A%0Adef make_indicator(self):%0A    %22%22%22Reusable indicator instance for testing purposes%22%22%22%0A    name = %22Bitcoin Indicator%22%0A    icon_path = os.path.abspath(%22bitcoin.png%22)%0A%0A    indicator = appindicator.Indicator.new(name, icon_path, appindicator.IndicatorCategory.SYSTEM_SERVICES)%0A    indicator.set_status(appindicator.IndicatorStatus.ACTIVE)%0A%0A    return indicator
 %0A%0A%0Ac
@@ -2367,28 +2367,705 @@
   self.assertIsNone(result)%0A
+%0A%0Aclass QueryLoopTest(unittest.TestCase):%0A    def test_valid_request(self):%0A        %22%22%22Make sure that the indicator label is presenting the correct message to the user when all is good%22%22%22%0A        indicator = make_indicator(self)%0A        exchange = Bitstamp(%22eur%22)%0A%0A        QueryLoop(indicator, exchange).start()%0A%0A        self.assertNotIn(%22Error%22, indicator.get_label())%0A%0A    def test_invalid_request(self):%0A        %22%22%22Make sure that the indicator displays an error message when there is an error%22%22%22%0A        indicator = make_indicator(self)%0A        exchange = Bitstamp(%22inv%22)%0A%0A        QueryLoop(indicator, exchange).start()%0A        self.assertIn(%22Error%22, indicator.get_label())%0A

Add some tests regarding the QueryLoop class