def test_returns_correct_asset(self): api = KnowsisClient(oauth_consumer_key, oauth_consumer_secret) asset = api.asset_sentiment(identifier="AAPL") self.assertEqual(asset.name, "Apple Inc")
def test_returns_data_for_last_period_by_default(self): api = KnowsisClient(oauth_consumer_key, oauth_consumer_secret) asset = api.asset_sentiment(identifier="AAPL") current_day = datetime.combine(datetime.utcnow(), time.min) self.assertEqual(asset.name, "Apple Inc") self.assertEqual(asset.startdate, current_day) self.assertEqual(asset.enddate, current_day)
def test_returns_data_for_daterange_specified(self): api = KnowsisClient(oauth_consumer_key, oauth_consumer_secret) startdate = datetime.combine(datetime.utcnow(), time.min) - timedelta(days=5) enddate = datetime.combine(datetime.utcnow(), time.min) - timedelta(days=2) asset = api.asset_sentiment(identifier="AAPL", startdate=startdate, enddate=enddate) self.assertEqual(asset.name, "Apple Inc") self.assertEqual(asset.startdate, startdate) self.assertEqual(asset.enddate, enddate)