def test_read_article_level6(get_session): session = get_session() article_repo = repository.ArticleRepository(session) user_repo = repository.UserRepository(session) username = '******' password = '******' user = model.User(username=username, password=password) with pytest.raises(services.NoArticleMatched): article_id = services.read(user, user_repo, article_repo, session)
def test_user_with_wrong_password(get_session): session = get_session() article_repo = repository.ArticleRepository(session) user_repo = repository.UserRepository(session) username = '******' password = '******' user = model.User(username=username, password=password) with pytest.raises(services.UnknownUser): article_id = services.read(user, user_repo, article_repo, session)
def test_user_with_wrong_username(get_session): session = get_session() article_repo = repository.ArticleRepository(session) user_repo = repository.UserRepository(session) username = '******' password = '******' user = model.User(username=username, password=password) with pytest.raises(services.UnknownUser): article_id = services.read( user, user_repo, article_repo, session ) # Software Architecture and Design Patterns -- Lab 3 starter code
def test_read_article_level5(get_session): session = get_session() article_repo = repository.ArticleRepository(session) user_repo = repository.UserRepository(session) username = '******' password = '******' user = model.User(username=username, password=password) article_id = services.read(user, user_repo, article_repo, session) result = session.execute( 'SELECT article_id FROM readings WHERE username=:username', dict(username=username), ) lst = [r[0] for r in result] assert article_id == 1 assert lst[0] == 1