Esempio n. 1
0
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
Esempio n. 5
0
 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)
Esempio n. 6
0
 def test_select_unique(self):
     resp = keen.select_unique("query test", target_property="number", timeframe="today")
     assert isinstance(resp, list)
Esempio n. 7
0
 def test_select_unique(self):
     resp = keen.select_unique("query test",
                               target_property="number",
                               timeframe="today")
     assert type(resp) is list