def get_all_projects(): """Query Keen.io database and retrieve a list of all projects.""" if not is_readable(): return [] try: result = keen.select_unique( "build_jobs", "buildtime_trend.project_name", max_age=3600 * 24 # cache for 24 hours ) except requests.ConnectionError: logger.error("Connection to Keen.io API failed") return [] except keen.exceptions.KeenApiError as msg: logger.error("Error in keenio.get_all_projects() : " + str(msg)) return [] if is_list(result): return result return []
def test_select_unique(self): resp = keen.select_unique("query test", target_property="number", timeframe="today") self.assertEqual(type(resp), list)
def test_select_unique(self, get): get.return_value = self.LIST_RESPONSE resp = keen.select_unique("query test", target_property="number", timeframe="today") self.assertEqual(type(resp), list)
def test_select_unique(self): resp = keen.select_unique("query test", target_property="number", timeframe="today") assert type(resp) is list
def test_select_unique(self): resp = keen.select_unique("query test", target_property="number", timeframe="today") assert isinstance(resp, list)