def test_get_ratings(self):
     ratings = r.get_ratings(self.single_stock)
     assert ('summary' in ratings)
     assert isinstance(ratings["summary"], dict)
     assert ("num_buy_ratings" in ratings["summary"])
     assert isinstance(ratings["summary"]["num_buy_ratings"], int)
     assert ("num_hold_ratings" in ratings["summary"])
     assert isinstance(ratings["summary"]["num_hold_ratings"], int)
     assert ("num_sell_ratings" in ratings["summary"])
     assert isinstance(ratings["summary"]["num_sell_ratings"], int)
     assert ('ratings' in ratings)
     assert isinstance(ratings["ratings"], list)
     for rating in ratings["ratings"]:
         assert isinstance(rating, dict)
         assert ("published_at" in rating)
         assert isinstance(rating["published_at"], str)
         assert ("text" in rating)
         assert isinstance(rating["published_at"], str)
         assert ("type" in rating)
         assert isinstance(rating["published_at"], str)
     assert ('instrument_id' in ratings)
     assert isinstance(ratings["instrument_id"], str)
     assert ('ratings_published_at' in ratings)
     assert isinstance(ratings["ratings_published_at"], str)
     fake_ratings = r.get_ratings(self.fake_stock)
     assert (fake_ratings == '')
예제 #2
0
 def test_get_ratings(self):
     ratings = r.get_ratings(self.single_stock)
     assert ('summary' in ratings)
     assert ('ratings' in ratings)
     assert ('instrument_id' in ratings)
     assert ('ratings_published_at' in ratings)
     fake_ratings = r.get_ratings(self.fake_stock)
     assert (fake_ratings == '')
예제 #3
0
 def test_get_ratings(self):
     ratings = r.get_ratings(self.single_stock)
     self.assertIn('summary', ratings)
     self.assertIn('ratings', ratings)
     self.assertIn('instrument_id', ratings)
     self.assertIn('ratings_published_at', ratings)
     fake_ratings = r.get_ratings(self.fake_stock)
     self.assertEqual(fake_ratings, '')
예제 #4
0
def ratings(symbol):
    ui.success(f'\nGet stock ratings for {symbol}....\n')
    result = rh.get_ratings(symbol)
    ui.success(result)