コード例 #1
0
ファイル: test_user_dao.py プロジェクト: jaunis/xivo-dao
    def test_delete(self):
        user1 = self.add_user(firstname='test1')
        generated_id = user1.id
        queuename = "my_queue"
        rightcallid = 3
        scheduleid = 4
        self.add_user_to_queue(user1.id, queuename)
        self.add_user_to_rightcall(user1.id, rightcallid)
        self.add_user_to_boss_secretary_callfilter(user1.id,
                                                   callfilter_name='test')
        self._add_dialaction_to_user(user1.id)
        self._add_function_key_to_user(user1.id)
        self._add_schedule_to_user(user1.id, scheduleid)
        self.session.expunge_all()

        deleted_rows_count = user_dao.delete(generated_id)

        self.assertEquals(deleted_rows_count, 1)
        self.assertRaises(LookupError, user_dao.get, generated_id)
        self._assert_no_queue_member_for_user(generated_id)
        self._assert_no_rightcall_for_user(generated_id)
        self._assert_no_callfilter_for_user(generated_id)
        self._assert_no_dialaction_for_user(generated_id)
        self._assert_no_funckey_for_user(generated_id)
        self._assert_no_schedule_for_user(generated_id)
コード例 #2
0
ファイル: test_user_dao.py プロジェクト: jaunis/xivo-dao
    def test_delete(self):
        user1 = self.add_user(firstname="test1")
        generated_id = user1.id
        queuename = "my_queue"
        rightcallid = 3
        scheduleid = 4
        self.add_user_to_queue(user1.id, queuename)
        self.add_user_to_rightcall(user1.id, rightcallid)
        self.add_user_to_boss_secretary_callfilter(user1.id, callfilter_name="test")
        self._add_dialaction_to_user(user1.id)
        self._add_function_key_to_user(user1.id)
        self._add_schedule_to_user(user1.id, scheduleid)
        self.session.expunge_all()

        deleted_rows_count = user_dao.delete(generated_id)

        self.assertEquals(deleted_rows_count, 1)
        self.assertRaises(LookupError, user_dao.get, generated_id)
        self._assert_no_queue_member_for_user(generated_id)
        self._assert_no_rightcall_for_user(generated_id)
        self._assert_no_callfilter_for_user(generated_id)
        self._assert_no_dialaction_for_user(generated_id)
        self._assert_no_funckey_for_user(generated_id)
        self._assert_no_schedule_for_user(generated_id)
コード例 #3
0
ファイル: test_user_dao.py プロジェクト: jaunis/xivo-dao
 def test_delete_unexisting_user(self):
     result = user_dao.delete(1)
     self.assertEqual(result, 0)
コード例 #4
0
ファイル: test_user_dao.py プロジェクト: jaunis/xivo-dao
 def test_delete_unexisting_user(self):
     result = user_dao.delete(1)
     self.assertEqual(result, 0)