def test_successfully_reads_in_time_all_bears_when_a_lot_bears_exist( valid_bear): bears_db = BearsDB() bears_db.flud_with_bears(valid_bear, how_many_bears=A_LOT) time_start = time.monotonic() bears = bears_db.read_all_bears() time_end = time.monotonic() assert len(bears) >= A_LOT assert time_end - time_start < T_MAX_FOR_LOAD_TEST
def post_put_part_get_and_compare(valid_bear, param, value): bears_db = BearsDB() bear_id = bears_db.create_bear(valid_bear) valid_param = {param: value} bears_db.update_bear(bear_id, valid_param) bear = bears_db.read_bear(bear_id) assert bear.get(param) == value
def post_put_whole_get_and_compare(valid_bear, param, value): bears_db = BearsDB() bear_id = bears_db.create_bear(valid_bear) valid_bear[param] = value bears_db.update_bear(bear_id, valid_bear) bear = bears_db.read_bear(bear_id) assert bear.get(param) == value
def test_delete_all_works_when_no_bears(): bears_db = BearsDB() bears_db.delete_all_bears()
def test_successfully_creates_duplicate_valid_bear(valid_bear): bears_db = BearsDB() bears_db.create_bear(valid_bear) bears_db.create_bear(valid_bear)
def test_successfully_creates_bear_with_valid_params_and_unknown_param( valid_bear): valid_bear["unknown"] = "param" bears_db = BearsDB() bears_db.create_bear(valid_bear)
def test_successfully_reads_all_bears_when_bears_exist(valid_bear): bears_db = BearsDB() bears_db.flud_with_bears(valid_bear) bears = bears_db.read_all_bears() assert len(bears) >= A_FEW
def test_successfully_reads_all_bears_when_bears_not_exist(cleanup): bears_db = BearsDB() bears = bears_db.read_all_bears() assert bears == []
def test_successfully_deletes_all_existing_bears(valid_bear): bears_db = BearsDB() bears_db.flud_with_bears(valid_bear) bears_db.delete_all_bears() bears = bears_db.read_all_bears() assert bears == []
def test_successfully_deletes_all_when_no_bears(cleanup): bears_db = BearsDB() bears_db.delete_all_bears()