Esempio n. 1
0
def test_after_del():
    """tasks'count should sub 1 after tasks.del()"""
    task_id = tasks.add(tasks.Task('something'))
    count_before = tasks.count()
    tasks.delete(task_id)
    count_after = tasks.count()
    assert count_after == count_before - 1
 def test_delete_decreases_count(self):
     # GIVEN 3 items
     self.assertEqual(tasks.count(), 3)
     # WHEN we delete one
     tasks.delete(self.ids[0])
     # THEN count decreases by 1
     self.assertEqual(tasks.count(), 2)
Esempio n. 3
0
def test_after_add():
    """tasks's count should add 1 after tasks.add()"""
    count_before = tasks.count()
    task = tasks.Task('do something')
    tasks.add(task)
    count_after = tasks.count()
    assert count_after == count_before + 1
Esempio n. 4
0
def test_after_deletion_db_count_changes():
    """ Check, that after deletion count changes """
    tasks.start_tasks_db(str("."), 'tiny')
    before_deletion_count = tasks.count()
    tasks.delete(pytest.task_id)
    after_deletion_count = tasks.count()
    assert before_deletion_count - 1 == after_deletion_count
    tasks.stop_tasks_db()
Esempio n. 5
0
def test_after_update_db_count_not_change():
    """ Check, that after update count doesn't change """
    tasks.start_tasks_db(str("."), 'tiny')
    before_update_count = tasks.count()
    tasks.update(pytest.task_id, Task(done=True))
    after_update_count = tasks.count()
    assert before_update_count == after_update_count
    tasks.stop_tasks_db()
Esempio n. 6
0
def test_delete_decreases_count(db_with_3_tasks):
    ids = [t.id for t in tasks.list_tasks()]
    # GIVEN 3 items
    assert tasks.count() == 3
    # WHEN we delete one
    tasks.delete(ids[0])
    # THEN counte decreases by 1
    assert tasks.count() == 2
Esempio n. 7
0
def test_after_task_creation_db_count_changes():
    """ Check, that after task creation count chages """
    tasks.start_tasks_db(str("."), 'tiny')
    before_creation_count = tasks.count()
    task = Task('breathe', 'Brian', True)
    pytest.task_id = tasks.add(task)
    actual_count = tasks.count()
    assert before_creation_count + 1 == actual_count
    tasks.stop_tasks_db()
Esempio n. 8
0
def test_count_multiple():
    """Test after adding three tasks."""
    for e in ['do something', 'do nothing', 'do else']:   
        new_task = Task(e)   
        tasks.add(new_task)
    tasks_nr = tasks.count()
    assert tasks_nr == 3   
Esempio n. 9
0
def test_add_increases_count(db_with_3_tasks):
    '''Test tasks.add() affect on tasks.count()'''
    # GIVEN a DB with 3 tasks
    # WHEN another task is added
    tasks.add(Task('throw a party'))
    # THEN count increases by one
    assert tasks.count() == 4
Esempio n. 10
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()
Esempio n. 11
0
def test_add_increases_count(db_with_3_tasks):
    """test tasks.add() affect n tasks.count()"""
    # GIVEN a db with 3 tasks
    # WHEN another task is added
    tasks.add(Task('Throw a party'))
    # then the count increases by one
    assert tasks.count() == 4
Esempio n. 12
0
def test_add_increases_count(db_with_3_tasks):
    """Test tasks.add() affect on tasks.count()."""
    # Given a db with 3 tasks
    # When another tasks is added
    tasks.add(Task('throw a party'))
    # Then the count incerases by 1
    assert tasks.count() == 4
Esempio n. 13
0
def test_conftest_fixture(tasks_just_a_few):
    for task in tasks_just_a_few:
        tasks.add(task)

    task_number = tasks.count()

    assert task_number == 3
Esempio n. 14
0
def test_add_increases_count(db_with_3_tasks):
    """Тест tasks.add() должен повлиять на tasks.count()."""
    # ДАНО: БД с 3 задачами
    # СДЕЛАТЬ: добавляется еще одна задача
    tasks.add(Task('throw a party'))

    # РЕЗУЛЬТАТ: счетчик увеличивается на 1
    assert tasks.count() == 4
Esempio n. 15
0
def test_add_increases_count(db_with_3_tasks):
    """Test tasks.add() affet on tasks.count()."""
    # GIVEN a db with 3 tasks
    #  WHEN another task is added
    tasks.add(Task('throw a party'))

    #  THEN the count increases by 1
    assert tasks.count() == 4
def test_delete_task(db_with_4_tasks_id_returned):
    ids = db_with_4_tasks_id_returned.keys()
    first_id, *rest = ids
    tasks.delete(first_id)

    all_ids = [t.id for t in tasks.list_tasks()]
    assert tasks.count() == len(rest)
    assert first_id not in all_ids
Esempio n. 17
0
def test_add_increases_count(db_with_3_tasks):
    """
    Test tasks.add() affect on tasks.count().
    """
    tasks.add(Task("throw a party"))

    # countの値が増える
    assert tasks.count() == 4
Esempio n. 18
0
def test_count_remove():
    """Test after removing a task."""
    for e in ['do something', 'do nothing', 'do else']:   
        new_task = Task(e)   
        tasks.add(new_task)
    tasks.delete(3)
    tasks_nr = tasks.count()
    assert tasks_nr == 2   
Esempio n. 19
0
def test_count_returns_one_for_database_with_one_task():
    """tasks.count() should return one for a database with one task."""
    # GIVEN an initialized tasks db
    # WHEN a new task is added
    #   AND count is called
    # THEN one should be returned
    tasks.add(Task('do something'))
    assert tasks.count() == 1
Esempio n. 20
0
def test_count():
    task = Task('breath', 'BRAIN', True)
    task2 = Task('breath1', 'BRAIN1', True)
    tasks.add(task)
    tasks.add(task2)
    task_number = tasks.count()

    assert task_number == 2
Esempio n. 21
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  
Esempio n. 22
0
def test_count_returns_two_for_database_with_two_tasks():
    """tasks.count() should return two for a database with two tasks."""
    # GIVEN an initialized tasks db
    # WHEN two tasks are added
    #   AND count is called
    # THEN one should be returned
    tasks.add(Task('do something'))
    tasks.add(Task('do something else'))
    assert tasks.count() == 2
def test_delete_task():
    ids = [tasks.add(t) for t in tasks_to_try]
    first_id, *rest = ids
    tasks.delete(first_id)

    all_ids = [t.id for t in tasks.list_tasks()]
    #assert tasks.get(first_id) == None get не работает на удаленном Task
    assert tasks.count() == len(rest)
    assert first_id not in all_ids
Esempio n. 24
0
def test_add_increases_count(
        db_with_3_tasks
):  # db_with_3_tasks is ficture test defined in conftest.py
    """Test tasks.add() affect on tasks.count()."""
    # GIVEN a db with 3 tasks
    #  WHEN another task is added
    tasks.add(Task('throw a party'))

    #  THEN the count increases by 1
    assert tasks.count() == 4
Esempio n. 25
0
def test_add_increase_count(db_with_3_tasks):
    tasks.add(Task("do something"))
    assert tasks.count() == 4
Esempio n. 26
0
def test_count():
    """tasks.count(none) should return an integer."""
    # GIVEN an initialized tasks db
    # THEN returned task_count is of type int
    task_count = tasks.count()
    assert isinstance(task_count, int)
Esempio n. 27
0
def count(infile, outfile):
    result = tasks.count(infile, outfile, config)
    report(result)
Esempio n. 28
0
def test_add_increases_count(db_with_3_tasks):
    tasks.add(Task('throw a party'))
    assert tasks.count() == 4
Esempio n. 29
0
def count(infile, outfile):
    result = tasks.count(infile, outfile, config)
    report(result)
def test_count_func():
    """Test tasks.count"""
    for t in tasks_to_try:
        tasks.add(t)
    assert tasks.count() == len(tasks_to_try)
Esempio n. 31
0
def test_count_returns_zero_for_empty_database():
    """tasks.count() should return zero for an empty database."""
    # GIVEN an initialized tasks db
    # WHEN count is call
    # THEN zero should be returned
    assert tasks.count() == 0