def test_HttpError(self, get_mock): http_error = requests.exceptions.HTTPError('Unable to connect') mock_raise_for_status = Mock(side_effect=http_error) get_mock.raise_for_status = mock_raise_for_status get_mock.side_effect = http_error m = market() with pytest.raises(requests.exceptions.HTTPError): m.coin('bitcoin')
def test_stats_repr(self): m = market() stats = m.stats() self.assertEqual("Stats", repr(stats))
def test_stats_str(self): m = market() stats = m.stats() self.assertIn("Market value:", str(stats))
def test_coin_repr(self): m = market() coin = m.coin('bitcoin') self.assertEqual("Coin", repr(coin))
def test_coin_str(self): m = market() coin = m.coin('bitcoin') self.assertIn("Coin:", str(coin))
def test_stats(self): m = market() stats = m.stats() self.assertStats(stats)
def test_ethereum(self): m = market() coin = m.coin('ethereum') self.assertCoin(coin, 'ethereum', 'Ethereum', 'ETH')
def test_bitcoin(self): m = market() coin = m.coin('bitcoin') self.assertCoin(coin, 'bitcoin', 'Bitcoin', 'BTC')