コード例 #1
0
    def test_find_by_name(self):
        params = {'year': 2017, 'employee_name': 'empl'}
        plans = PlanCtrl.find(params)
        self.assertEqual(len(plans), 1)

        params = {'year': 2017, 'employee_name': '-empl'}
        plans = PlanCtrl.find(params)
        self.assertEqual(len(plans), 0)
コード例 #2
0
    def test_delete_month(self):
        # Проверка , что лишнее не удаляется
        PlanCtrl.delete_month(3000, 12)
        plan = Plan.get(1)
        self.assertEqual(plan.n, 1)

        # А вот теперь должно удалиться
        PlanCtrl.delete_month(2017, 12)
        plans = PlanCtrl.find({})
        self.assertEqual(len(plans), 0)
コード例 #3
0
    def test_find_by_date(self):
        params = {'year': 2017}
        plans = PlanCtrl.find(params)
        self.assertEqual(len(plans), 1)

        params = {'year': 2000}
        plans = PlanCtrl.find(params)
        self.assertEqual(len(plans), 0)

        params = {'month': 12}
        plans = PlanCtrl.find(params)
        self.assertEqual(len(plans), 1)

        params = {'year': 2000, 'month': 12}
        plans = PlanCtrl.find(params)
        self.assertEqual(len(plans), 0)

        params = {'year': 2017, 'month': 12}
        plans = PlanCtrl.find(params)
        self.assertEqual(len(plans), 1)