def test_remind_every_n_hours(self): client = SchedulerExtensionClient() client_context = client.create_client_context("testid") extension = SchedulerExtension() response = extension.execute( client_context, "SCHEDULE EVERY 10 HOURS TEXT WAKEY WAKEY") self.assertEqual("OK", response)
def test_schedule_in_n_seconds(self): client = SchedulerExtensionClient() client_context = client.create_client_context("testid") extension = SchedulerExtension() response = extension.execute( client_context, "SCHEDULE IN 10 SECONDS TEXT WAKEY WAKEY") self.assertEqual("OK", response)
def test_remind_in_n_weeks(self): client = SchedulerExtensionClient() client_context = client.create_client_context("testid") extension = SchedulerExtension() response = extension.execute(client_context, "SCHEDULE IN 10 WEEKS TEXT WAKEY WAKEY") self.assertEqual("OK", response)
def test_stop_job_no_jobs(self): client = SchedulerExtensionClient() client_context = client.create_client_context("testid") client_context.client._scheduler = MockScheduler() extension = SchedulerExtension() response = extension.execute(client_context, "SCHEDULE STOP 1") self.assertEquals("ERR", response)
def test_schedule_invalid(self): client = SchedulerExtensionClient() client_context = client.create_client_context("testid") extension = SchedulerExtension() self.assertEquals("ERR", extension.execute(client_context, "OTHER")) self.assertEquals("ERR", extension.execute(client_context, "SCHEDULE OTHER"))
def test_list_no_userid_jobs(self): client = SchedulerExtensionClient() client_context = client.create_client_context("testid") client_context.client._scheduler = MockScheduler() client_context.client._scheduler.add_jobs({1: MockJob(1, "testid2")}) extension = SchedulerExtension() response = extension.execute(client_context, "SCHEDULE LIST") self.assertEquals("ERR", response)
def test_stop_all(self): client = SchedulerExtensionClient() client_context = client.create_client_context("testid") client_context.client._scheduler = MockScheduler() client_context.client._scheduler.add_jobs({1: MockJob(1, "testid")}) extension = SchedulerExtension() response = extension.execute(client_context, "SCHEDULE STOP ALL") self.assertEquals("OK", response)
def test_resume_job_diff_id(self): client = SchedulerExtensionClient() client_context = client.create_client_context("testid") client_context.client._scheduler = MockScheduler() client_context.client._scheduler.add_jobs({1: MockJob(1, "testid")}) extension = SchedulerExtension() response = extension.execute(client_context, "SCHEDULE RESUME 2") self.assertEquals("ERR", response)
def test_list_mulit_userids(self): client = SchedulerExtensionClient() client_context = client.create_client_context("testid") client_context.client._scheduler = MockScheduler() client_context.client._scheduler.add_jobs({ 1: MockJob(1, "testid"), 2: MockJob(2, "testid2"), 3: MockJob(3, "testid") }) extension = SchedulerExtension() response = extension.execute(client_context, "SCHEDULE LIST") self.assertEquals("OK <olist><item>1</item><item>3</item></olist>", response)
def test_schedule_in_invalid(self): client = SchedulerExtensionClient() client_context = client.create_client_context("testid") extension = SchedulerExtension() self.assertEquals("ERR", extension.execute(client_context, "SCHEDULE IN")) self.assertEquals("ERR", extension.execute(client_context, "SCHEDULE IN 10")) self.assertEquals( "ERR", extension.execute(client_context, "SCHEDULE IN 10 OTHER")) self.assertEquals( "ERR", extension.execute(client_context, "SCHEDULE IN 10 MINUTES OTHER")) self.assertEquals( "ERR", extension.execute(client_context, "SCHEDULE IN 10 MINUTES TEXT")) self.assertEquals( "ERR", extension.execute(client_context, "SCHEDULE IN 10 MINUTES SRAI"))
def test_remind_every_n_weeks(self): client = SchedulerExtensionClient() client_context = client.create_client_context("testid") extension = SchedulerExtension() response = extension.execute(client_context, "SCHEDULE EVERY 10 WEEKS TEXT WAKEY WAKEY") self.assertEquals("OK", response)
def test_remind_in_n_days(self): client = SchedulerExtensionClient() client_context = client.create_client_context("testid") extension = SchedulerExtension() response = extension.execute(client_context, "SCHEDULE IN 10 DAYS TEXT WAKEY WAKEY") self.assertEquals("OK", response)
def test_remind_every_n_weeks(self): client = SchedulerExtensionClient() client_context = client.create_client_context("testid") extension = SchedulerExtension() response = extension.execute(client_context, "REMIND EVERY 10 WEEKS MESSAGE WAKEY WAKEY") self.assertEquals("OK", response)
def test_remind_in_n_days(self): client = SchedulerExtensionClient() client_context = client.create_client_context("testid") extension = SchedulerExtension() response = extension.execute(client_context, "REMIND IN 10 DAYS MESSAGE WAKEY WAKEY") self.assertEquals("OK", response)