def test_get_price(self):
        coin = Coin("bitcoin",
                    symbol=None,
                    price=123.123,
                    price_previous=None,
                    in_message=True,
                    last_updated=None)

        self.assertEqual(coin.get_price(), 123.123)
Ejemplo n.º 2
0
class CoinTests(unittest.TestCase):
    """test the Coin class"""
    def setUp(self):
        self.coin = Coin(1, "Bitcoin", "BTC", 160572147215, 9037.88)

    def test_get_price(self):
        """test that the get_price method returns the correct price"""
        self.assertEqual(self.coin.get_price(), 9037.88)

    def test_all_data(self):
        """test that the all_data method returns all the correct data"""
        self.assertEqual(self.coin.get_all_data(), [1, "Bitcoin", "BTC", 160572147215, 9037.88])
    def test_init(self):
        coin = Coin("bitcoin",
                    symbol="btc",
                    price=None,
                    price_previous=None,
                    in_message=True,
                    last_updated=None)

        self.assertEqual(coin.get_id(), "bitcoin")
        self.assertEqual(coin.get_symbol(), "btc")
        self.assertEqual(coin.get_price(), None)
        self.assertEqual(coin.get_price_previous(), None)
        self.assertEqual(coin.get_price_change(), None)
        self.assertEqual(coin.get_in_message(), True)
        self.assertEqual(coin.get_last_updated(), None)