def db_with_4_tasks_id_returned(tasks_db, tasks_for_same_user):
    id_task_mapping = {}
    for t in tasks_for_same_user:
        tid = tasks.add(t)
        id_task_mapping[tid] = t
    yield id_task_mapping
    tasks.delete_all()
 def setUP(self):
     tasks.delete_all()  # start empty
     # add a few items, saving ids
     self.ids = []
     self.ids.append(tasks.add(Task('One', 'Brian', True)))
     self.ids.append(tasks.add(Task('Two', 'Still Brian', False)))
     self.ids.append(tasks.add(Task('Three', 'Not Brian', False)))
예제 #3
0
def test_db_has_no_signs_by_default():
    """Check, that after initialization db has 0 signes"""
    tasks.start_tasks_db(str("."), 'tiny')
    tasks.delete_all()
    cur_count = tasks.count()
    assert cur_count == 0
    tasks.stop_tasks_db()
예제 #4
0
def tasks_db_non_empty(tasks_db_session, request):
    tasks.delete_all()  # start empty
    # add a few items, saving ids
    ids = []
    ids.append(tasks.add(Task('One', 'Brian', True)))
    ids.append(tasks.add(Task('Two', 'Still Brian', False)))
    ids.append(tasks.add(Task('Three', 'Not Brian', False)))
    request.cls.ids = ids
예제 #5
0
def test_count_empty():
    """Test county afeter emptying the database"""
    for e in ['do something', 'do nothing', 'do else']:   
        new_task = Task(e)   
        tasks.add(new_task)
    tasks.delete_all()
    tasks_nr = tasks.count()
    assert tasks_nr == 0  
예제 #6
0
def tasks_db(task_db_session):
    # セットアップ
    # tasks.start_tasks_db(str(tmpdir), 'tiny')

    # テスト実行
    # yield

    # ティアーダウン
    # tasks.stop_tasks_db()

    # データベースを空にするのみ
    tasks.delete_all()
def init_tasks_db(tasks_db_session):
    """ An empty tasks db. """
    tasks.delete_all()
예제 #8
0
def tasks_db(tasks_db_session):
    tasks.delete_all()
예제 #9
0
파일: conftest.py 프로젝트: njsdias/Pytest
def tasks_db(tasks_db_session):
    """An empty tasks db."""
    tasks.delete_all()  # we deleted all the
def test_delete_all_tasks():
    ids = [tasks.add(t) for t in tasks_to_try]
    tasks.delete_all()
    get_all_tasks = tasks.list_tasks()
    assert len(get_all_tasks) == 0
예제 #11
0
def tasks_db(tasks_db_session):
    '''An empty tasks db'''
    tasks.delete_all()
예제 #12
0
def tasks_db(tasks_db_session):
    """an empty tasks db"""
    tasks.delete_all()
def test_delete_all_tasks(db_with_4_tasks):
    tasks.delete_all()
    get_all_tasks = tasks.list_tasks()
    assert len(get_all_tasks) == 0
def tasks_db(initialized_db_session):
    """An empty tasks db."""
    tasks.delete_all()
예제 #15
0
def tasks_db_non_empty(tasks_db_session, request):
    tasks.delete_all()  # start empty
    ids = []
    ids.append(tasks.add(Task('One', 'Brian', True)))
    ids.append(tasks.add(Task('Two', 'Still Brian', False)))
    ids.append(tasks.add(Task('Three', 'Not Brian', False)))
예제 #16
0
def test_after_del_all():
    """tasks's count should be 0 after tasks.delete_all()"""
    task_id = tasks.add(tasks.Task('something'))
    tasks.delete_all()
    count_after = tasks.count()
    assert count_after == 0