def test_eRealizacoes_FindBook(self): bookName = "A Faca Entrou" mock = Book( image='/upload/produto/417/afacaentrou_frente160.jpg', price=54.90, url='/produto/a-faca-entrou---assassinos-reais-e-a-nossa-cultura') response = core.eRealizacoes(bookName)[0] assert mock == response
def test_quadrante_FindBook(self): bookName = "Vida eucarística" mock = Book( image= 'https://www.quadrante.com.br/media/catalog/product/cache/1/small_image/147x231/9df78eab33525d08d6e5fb8d27136e95/v/i/vida-eucaristica_1.jpg', price=21.60, url='https://www.quadrante.com.br/vida-eucaristica') response = core.quadrante(bookName)[1] assert mock == response
def test_cultorDeLivros_FindBook(self): bookName = "As três idades da vida interior" mock = Book( image= 'https://cultordelivros.fbitsstatic.net/img/p/as-tres-idades-da-vida-interior-78497/254979.jpg?w=270&h=405&v=201811131024', price=170.00, url='/produto/as-tres-idades-da-vida-interior-78497') response = core.cultorDeLivros(bookName)[0] assert mock == response
def test_SaoTomas_FindBook(self): bookName = "Da Arte do Belo" mock = Book( image= 'https://cdn.awsli.com.br/300x300/369/369566/produto/28636980/760d73c5f7.jpg', price='85,00', url='https://santotomas.lojaintegrada.com.br/daartedobelo') response = loja_integrada.saoTomas(bookName)[0] assert mock == response
def test_paulus_FindBook(self): bookName = "Youcat" mock = Book( image='images/products/M/9789723017717.jpg', price='ProdutoIndisponível', url= 'https://www.paulus.com.br/loja/youcat-update-confissao_p_3466.html' ) response = core.paulus(bookName)[0] assert mock == response
def mapper(product): check_price = product.find('span', {'class': 'price-new'}) if helpers.checkIfNone(check_price): price = check_price.text else: price = product.select_one('div.price').text return Book(image=product.find('img')['src'], price=helpers.priceFloat(price), url=product.select_one('div.product-image a')['href'], name=product.select_one('div.name a').text)
def loyola(bookName): url = "https://www.livrarialoyola.com.br/busca/" + bookName html = helpers.requestAndParse(url) books = list( map( lambda product: Book(image=product.find('img')['src'], price=helpers.priceFloat( product.select_one('ins').text), url=product.select_one('a')['href']), html.select('nav.listProducts li'))) return books
def santaCruz(bookName): url = "https://www.stacruzartigoscatolicos.com.br/loja/busca.php?loja=431290&palavra_busca=" + bookName html = helpers.requestAndParse(url) books = list( map( lambda product: Book(image=product.find('img')['src'], price=helpers.priceFloat( product.select_one('span.price').text), url=product.select_one('a')['href']), html.findAll('li', {'class': 'produto-item'}))) return books
def test_sociedadeChestertonBrasil_FindBook(self): bookName = "As três idades da vida interior" mock = Book( name="A Sabedoria do Padre Brown", image= 'https://www.sociedadechestertonbrasil.org/wp-content/uploads/2018/02/A-inocência-do-padre-Brown-1200-265x353.png', price=170.00, url='/produto/as-tres-idades-da-vida-interior-78497') response = core.sociedadeChestertonBrasil(bookName)[0] assert mock == response
def estanteVirtual(bookName): url = "https://www.estantevirtual.com.br/busca?q=" + bookName html = helpers.requestAndParse(url) books = list( map( lambda product: Book( image=product.find('img')['src'], price=helpers.priceFloat( product.select_one('strong.busca-price.m-min span').text), url=product['href']), html.select('a.busca-box'))) return books
def test_familiaCrista_FindBook(self): bookName = "Os Quatro Amores" mock = Book( image= 'https://www.livrariasfamiliacrista.com.br/media/catalog/product/cache/1/small_image/243x300/8104d67811b5b3c5190375b34be1f1fe/0/6/06_1.jpg', price=27.92, url= 'https://www.livrariasfamiliacrista.com.br/livro-os-quatro-amores-c-s-lewis.html' ) response = core.familiaCrista(bookName)[1] assert mock == response
def test_LivrariaFolha_FindBook(self): bookName = "A Sabedoria dos Antigos" mock = Book( image= '//images1.folha.com.br/livraria/images/a/7/1160107-160x160.png', price=3.90, url= 'https://livraria.folha.com.br/livros/filosofia/sabedoria-antigos-francis-bacon-1160107.html' ) response = core.livrariaFolha(bookName)[0] assert mock == response
def test_CentroDomBosco_FindBook(self): bookName = "Teologia Moral I" mock = Book( image= 'https://cdn.awsli.com.br/300x300/618/618258/produto/27781519/8a9370e179.jpg', price='95,00', url= 'https://loja.centrodombosco.org/teologia-moral-santo-afonso-de-ligorio' ) response = loja_integrada.centroDomBosco(bookName)[0] assert mock == response
def mapSociedadeChestertonBrasil(product): price = '' check_price = product.find('ins') if helpers.checkIfNone(check_price): price = product.select_one('ins span.woocommerce-Price-amount') else: price = product.select_one('span.price') return Book(image=product.find('img')['src'], price=helpers.priceFloat(price.text), url=product.find('a')['href'], name=product.select_one('li.title a').text, store="sociedadeChestertonBrasil")
def nandoMoura(bookName): url = "https://livraria.nandomoura.com/index.php?route=product/search&search=" + bookName html = helpers.requestAndParse(url) books = list( map( lambda product: Book(image=product.find('img')['src'], price=helpers.priceFloat( product.select_one( 'div.cart-price span.prices').text), url=product.find('a')['href'], name=product.select_one('span.title a').text, store="nandoMoura"), html.select('section.features-books div.slide'))) return books
def shalom(bookName): url = "https://livrariashalom.org/catalogsearch/result/index/?cat=9&q=" + bookName html = helpers.requestAndParse(url) books = list( map( lambda product: Book(image=product.find('img')['src'], price=helpers.priceFloat( product.select_one('span.price').text), url=product.select_one('a')['href'], name=product.find('a', { 'class': 'product-item-link' }).text, store='shalom'), html.select('ol.products div.product-item-info'))) return books
def livrariaFolha(bookName): url = "https://livraria.folha.com.br/busca?q=" + bookName + "&product_type=book&type_search=Buscar" html = helpers.requestAndParse(url) books = list( map( lambda product: Book(image=product.find('img')['src'], price=helpers.priceFloat( product.find('ins').text), url=product.find('a')['href'], name=product.find('h3', { 'class': 'title-prod' }).text, store="livrariaDaFolha"), html.select('section.cover-products div.spam2'))) return books
def paulus(bookName): url = "https://www.paulus.com.br/loja/search.php?q=" + bookName html = helpers.requestAndParse(url) books = list( map( lambda product: Book(image=" https://www.paulus.com.br/loja/" + product.find('img')['src'], price=helpers.priceFloat( product.select_one('span.preco').text), url=product.select_one('a')['href'], name=product.find('p', { 'class': 'titulo' }).text, store='paulus'), html.select('ul#produto-lista li'))) return books
def mapCancaoNova(product): check_price = product.find('span', {'class': 'regular-price'}) check_out_stock = product.find('div', {'class': 'out-of-stock'}) if not helpers.checkIfNone(check_out_stock): if helpers.checkIfNone(check_price): price = product.select_one('span.regular-price span.price').text else: price = product.select_one('p.special-price span.price').text price = helpers.priceFloat(price) else: price = 'Fora de Estoque' return Book(image=product.find('img')['src'], price=helpers.cleanPrice(price), url=product.find('a', {'class': 'product-image'})['href'], name=product.select_one('h2.product-name a').text, store="cancaoNova")
def mapQuadrante(product): check_price = product.find('span', {'class': 'regular-price'}) check_out_stock = product.find('div', {'class': 'out-of-stock'}) if not helpers.checkIfNone(check_out_stock): if helpers.checkIfNone(check_price): price = product.select_one('span.regular-price span.price').text else: price = product.select_one('p.special-price span.price').text price = helpers.priceFloat(price) else: price = None return Book(image=product.find('img')['src'], price=price, url=product.find('a')['href'], name=product.select_one('h2.product-name a').text, store="quadrante")
def caritatem(bookName): url = "https://www.livrariacaritatem.com.br/search/?q=" + bookName html = helpers.requestAndParse(url) books = list( map( lambda product: Book(image="http:" + product.select_one( 'div.item-image-container img')['src'], price=helpers.priceFloat( product.select_one('div#price_display'). text), url=product.find('a')['href'], name=product.find('h2', { 'class': 'item-name' }).text, store='caritatem'), html.select('section.product-grid div.item'))) return books
def cultorDeLivros(bookName): url = "https://www.cultordelivros.com.br/busca?busca=" + bookName html = helpers.requestAndParse(url) books = list( map( lambda product: Book( image=product.find('img')['src'], price=helpers.priceFloat( product.select_one('div.precoPor span.fbits-valor').text), url="https://www.cultordelivros.com.br" + product.select_one( 'a')['href'], name=product.find('h3', { 'class': 'spotTitle' }).text, store="cultorDeLivros"), html.select('div.spots-interna div.spotContent'))) return books
def eRealizacoes(bookName): url = "https://www.erealizacoes.com.br/busca?palavra=" + bookName html = helpers.requestAndParse(url) books = list( map( lambda product: Book(image="https://www.erealizacoes.com.br/" + product.find('img')['src'], price=helpers.priceFloat( product.find('p', { 'class': 'preco-atual' }).text), url="https://www.erealizacoes.com.br/" + product.find('a')['href'], name=product.select_one('h3 a').text, store="eRealizacoes"), html.select('div.lista-livros ul li'))) return books
def mapper(product): return Book(image=product.find('img')['src'], price=helpers.cleanPrice( product.select_one('strong.preco-promocional').text), url=product.find('a')['href'])