コード例 #1
0
def test_schedule():
    client = mock.MagicMock()
    schedule = models.Schedule(client,
                               "name",
                               "cron",
                               "query",
                               database="database",
                               result_url="result_url",
                               timezone="timezone",
                               delay="delay",
                               next_time="next_time",
                               priority="priority",
                               retry_limit="retry_limit",
                               org_name="org_name",
                               user_name="user_name")
    assert schedule.name == "name"
    assert schedule.cron == "cron"
    assert schedule.query == "query"
    assert schedule.database == "database"
    assert schedule.result_url == "result_url"
    assert schedule.timezone == "timezone"
    assert schedule.delay == "delay"
    assert schedule.priority == "priority"
    assert schedule.retry_limit == "retry_limit"
    assert schedule.org_name == "org_name"
    assert schedule.user_name == "user_name"
コード例 #2
0
ファイル: client.py プロジェクト: xiaoyugit/td-client-python
 def schedules(self):
     """
     TODO: add docstring
     [:class:`tdclient.models.Schedule`]
     """
     result = self.api.list_schedules()
     return [models.Schedule(self, **m) for m in result]
コード例 #3
0
    def schedules(self):
        """Get the list of all the scheduled queries.

        Returns:
            [:class:`tdclient.models.Schedule`]
        """
        result = self.api.list_schedules()
        return [models.Schedule(self, **m) for m in result]
コード例 #4
0
def test_schedule_run():
    client = mock.MagicMock()
    schedule = models.Schedule(client,
                               "name",
                               "cron",
                               "query",
                               database="database",
                               result_url="result_url",
                               timezone="timezone",
                               delay="delay",
                               next_time="next_time",
                               priority="priority",
                               retry_limit="retry_limit",
                               org_name="org_name")
    t = int(time.time())
    schedule.run(t)
    client.run_schedule.assert_called_with("name", t, None)