Feat: add e2e test for api

This commit is contained in:
2022-12-28 07:47:35 +01:00
parent 4a16444835
commit ccf1655cf4
8 changed files with 210 additions and 19 deletions

View File

@@ -2,7 +2,6 @@ import sqlite3
import pytest
from backend.adapters.sqlite import create_db
from backend.model.student import Student
from backend.model.tribe import Tribe
from backend.repository.student_sqlite_repository import StudentSQLiteRepository
@@ -25,7 +24,6 @@ def populate_students(conn, tribes: list[Tribe]) -> list[Student]:
def test_get_student(sqlite_conn):
create_db(sqlite_conn)
prebuild_tribes = populate_tribes(sqlite_conn)
prebuild_students = populate_students(sqlite_conn, prebuild_tribes)
@@ -38,7 +36,6 @@ def test_get_student(sqlite_conn):
def test_get_student_not_exists(sqlite_conn):
create_db(sqlite_conn)
prebuild_tribes = populate_tribes(sqlite_conn)
prebuild_students = populate_students(sqlite_conn, prebuild_tribes)
@@ -48,7 +45,6 @@ def test_get_student_not_exists(sqlite_conn):
def test_list_students(sqlite_conn):
create_db(sqlite_conn)
prebuild_tribes = populate_tribes(sqlite_conn)
prebuild_students = populate_students(sqlite_conn, prebuild_tribes)
@@ -59,7 +55,6 @@ def test_list_students(sqlite_conn):
def test_add_student(sqlite_conn):
create_db(sqlite_conn)
prebuild_tribes = populate_tribes(sqlite_conn)
student_repo = StudentSQLiteRepository(sqlite_conn)
@@ -82,7 +77,6 @@ def test_add_student(sqlite_conn):
def test_add_student_fail_exists(sqlite_conn):
create_db(sqlite_conn)
prebuild_tribes = populate_tribes(sqlite_conn)
student_repo = StudentSQLiteRepository(sqlite_conn)
@@ -97,7 +91,6 @@ def test_add_student_fail_exists(sqlite_conn):
def test_update_student(sqlite_conn):
create_db(sqlite_conn)
prebuild_tribes = populate_tribes(sqlite_conn)
prebuild_students = populate_students(sqlite_conn, prebuild_tribes)
@@ -118,7 +111,6 @@ def test_update_student(sqlite_conn):
def test_delete_student(sqlite_conn):
create_db(sqlite_conn)
prebuild_tribes = populate_tribes(sqlite_conn)
prebuild_students = populate_students(sqlite_conn, prebuild_tribes)

View File

@@ -2,7 +2,6 @@ import sqlite3
import pytest
from backend.adapters.sqlite import create_db
from backend.model.tribe import Tribe
from backend.repository.tribe_sqlite_repository import TribeSQLiteRepository
from tests.model.fakes import build_tribes
@@ -23,7 +22,6 @@ def populate_tribes(conn) -> list[Tribe]:
def test_get_tribe(sqlite_conn):
create_db(sqlite_conn)
prebuild_tribes = populate_tribes(sqlite_conn)
name = prebuild_tribes[0].name
@@ -35,7 +33,6 @@ def test_get_tribe(sqlite_conn):
def test_get_tribe_not_exists(sqlite_conn):
create_db(sqlite_conn)
prebuild_tribes = populate_tribes(sqlite_conn)
tribe_repo = TribeSQLiteRepository(sqlite_conn)
@@ -44,7 +41,6 @@ def test_get_tribe_not_exists(sqlite_conn):
def test_list_tribes(sqlite_conn):
create_db(sqlite_conn)
prebuild_tribes = populate_tribes(sqlite_conn)
tribe_repo = TribeSQLiteRepository(sqlite_conn)
@@ -54,7 +50,6 @@ def test_list_tribes(sqlite_conn):
def test_add_tribe(sqlite_conn):
create_db(sqlite_conn)
tribe_repo = TribeSQLiteRepository(sqlite_conn)
@@ -76,7 +71,6 @@ def test_add_tribe(sqlite_conn):
def test_add_tribe_fail_exists(sqlite_conn):
create_db(sqlite_conn)
prebuild_tribes = populate_tribes(sqlite_conn)
tribe_repo = TribeSQLiteRepository(sqlite_conn)
@@ -87,7 +81,6 @@ def test_add_tribe_fail_exists(sqlite_conn):
def test_update_tribe(sqlite_conn):
create_db(sqlite_conn)
prebuild_tribes = populate_tribes(sqlite_conn)
tribe_repo = TribeSQLiteRepository(sqlite_conn)
@@ -102,7 +95,6 @@ def test_update_tribe(sqlite_conn):
def test_delete_tribe(sqlite_conn):
create_db(sqlite_conn)
prebuild_tribes = populate_tribes(sqlite_conn)
tribe_repo = TribeSQLiteRepository(sqlite_conn)