def test_create_with_all_fields(self): schedule_model = Schedule( name='schedule', tenant_uuid=self.default_tenant.uuid, timezone='time/zone', fallback_action='user', fallback_actionid='2', fallback_actionargs='10', enabled=False, ) schedule = schedule_dao.create(schedule_model) self.session.expire_all() assert_that(inspect(schedule).persistent) assert_that( schedule, has_properties( name='schedule', tenant_uuid=self.default_tenant.uuid, timezone='time/zone', fallback_action='user', fallback_actionid='2', fallback_actionargs='10', enabled=False, ))
def test_create_minimal_fields(self): schedule_model = Schedule(tenant_uuid=self.default_tenant.uuid) schedule = schedule_dao.create(schedule_model) self.session.expire_all() assert_that(inspect(schedule).persistent) assert_that( schedule, has_properties(id=is_not(none()), tenant_uuid=self.default_tenant.uuid, name=None, timezone=None, fallback_action='none', type='none', fallback_actionid=None, actionarg1=None, fallback_actionargs=None, actionarg2=None, enabled=True))
def add_schedule(self, **kwargs): kwargs.setdefault('tenant_uuid', self.default_tenant.uuid) schedule = Schedule(**kwargs) self.add_me(schedule) return schedule
def _insert_schedule(self, name): schedule = Schedule() schedule.name = name self.add_me(schedule) return schedule.id
def test_add(self): schedule = Schedule() schedule.name = 'test' schedule_dao.add(schedule) self.assertEquals(schedule, self.session.query(Schedule).first())
def test_add(self): schedule = Schedule() schedule.name = "test" schedule_dao.add(schedule) self.assertEquals(schedule, self.session.query(Schedule).first())