Esempio n. 1
0
	def test_day_full_month(self):
		hour, minute = Utils.get_time_now()
		entry = "{} {} 14 3 * ls # SuperCron__TEST__ls".format(minute, hour).encode()
		args = Namespace(Utils.list_to_dict("TEST__ls", "ls", "14 march"))
		SuperCron.add_job(args)
		user_crontab = Utils.get_crontab()
		self.assertTrue(entry in user_crontab)
Esempio n. 2
0
	def test_mixed_month_weekday_every_x_hours(self):
		hour, minute = Utils.get_time_now()
		entry = "{} */4 * 4 6 ls # SuperCron__TEST__ls".format(minute).encode()
		args = Namespace(Utils.list_to_dict("TEST__ls", "ls", "every 4 hours on saturdays in april"))
		SuperCron.add_job(args)
		user_crontab = Utils.get_crontab()
		self.assertTrue(entry in user_crontab)
Esempio n. 3
0
	def test_every_x_days(self):
		hour, minute = Utils.get_time_now()
		entry = "{} {} */11 * * ls # SuperCron__TEST__ls".format(minute, hour).encode()
		args = Namespace(Utils.list_to_dict("TEST__ls", "ls", "once every 11 days"))
		SuperCron.add_job(args)
		user_crontab = Utils.get_crontab()
		self.assertTrue(entry in user_crontab)
Esempio n. 4
0
	def test_months_multiple_backward(self):
		hour, minute = Utils.get_time_now()
		entry = "{} {} * 1,10,11,12 * ls # SuperCron__TEST__ls".format(minute, hour).encode()
		args = Namespace(Utils.list_to_dict("TEST__ls", "ls", "from October to January"))
		SuperCron.add_job(args)
		user_crontab = Utils.get_crontab()
		self.assertTrue(entry in user_crontab)
Esempio n. 5
0
	def test_short_months(self):
		hour, minute = Utils.get_time_now()
		entry = "{} {} * 1,10,11,12 * ls # SuperCron__TEST__ls".format(minute, hour).encode()
		args = Namespace(Utils.list_to_dict("TEST__ls", "ls", "from oct to jan"))
		SuperCron.add_job(args)
		user_crontab = Utils.get_crontab()
		self.assertTrue(entry in user_crontab)
Esempio n. 6
0
	def test_months_multiple_forward(self):
		hour, minute = Utils.get_time_now()
		entry = "{} {} * 6-8 * ls # SuperCron__TEST__ls".format(minute, hour).encode()
		args = Namespace(Utils.list_to_dict("TEST__ls", "ls", "from June to August"))
		SuperCron.add_job(args)
		user_crontab = Utils.get_crontab()
		self.assertTrue(entry in user_crontab)
Esempio n. 7
0
	def test_months_multiple_non_consecutive(self):
		hour, minute = Utils.get_time_now()
		entry = "{} {} * 2,5,9 * ls # SuperCron__TEST__ls".format(minute, hour).encode()
		args = Namespace(Utils.list_to_dict("TEST__ls", "ls", "in May and September and February"))
		SuperCron.add_job(args)
		user_crontab = Utils.get_crontab()
		self.assertTrue(entry in user_crontab)
Esempio n. 8
0
	def test_months_single(self):
		hour, minute = Utils.get_time_now()
		entry = "{} {} * 5 * ls # SuperCron__TEST__ls".format(minute, hour).encode()
		args = Namespace(Utils.list_to_dict("TEST__ls", "ls", "in May"))
		SuperCron.add_job(args)
		user_crontab = Utils.get_crontab()
		self.assertTrue(entry in user_crontab)
Esempio n. 9
0
	def test_weekdays_multiple_backward(self):
		hour, minute = Utils.get_time_now()
		entry = "{} {} * * 0,1,5,6 ls # SuperCron__TEST__ls".format(minute, hour).encode()
		args = Namespace(Utils.list_to_dict("TEST__ls", "ls", "from friday to monday"))
		SuperCron.add_job(args)
		user_crontab = Utils.get_crontab()
		self.assertTrue(entry in user_crontab)
Esempio n. 10
0
	def test_weekdays_multiple_non_consecutive(self):
		hour, minute = Utils.get_time_now()
		entry = "{} {} * * 1,3,5 ls # SuperCron__TEST__ls".format(minute, hour).encode()
		args = Namespace(Utils.list_to_dict("TEST__ls", "ls", "on mondays, wednesdays and fridays"))
		SuperCron.add_job(args)
		user_crontab = Utils.get_crontab()
		self.assertTrue(entry in user_crontab)