Skip to content

Commit

Permalink
Added test for splendor
Browse files Browse the repository at this point in the history
  • Loading branch information
RaresCode committed Aug 15, 2023
1 parent e5b2d4c commit 9272e37
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions tests/test_splendor.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import pytest
from sites.splendor import splendorScrapper
from utils import TestUtils

class SetupTests:

def get_jobs_careers(self):
"""
Fixture for scraping process from career section.
"""
URL = 'https://www.splendor.ro/cariera.html'
URL_LOGO = 'https://www.splendor.ro/webroot/img/logo/splendor_logo1.png'
company_name = 'splendor'
splendor = splendorScrapper(company_name, URL, URL_LOGO)
splendor.get_response()
splendor.scrape_jobs()
# splendor.send_to_viitor()

self.scraper_data = splendor.return_data()

class Test_splendor(SetupTests):

@pytest.fixture()
def get_data(self):
self.get_jobs_careers()

# You can now use the utility methods from TestUtils to avoid code duplication
self.scraped_jobs_data = TestUtils.scrape_jobs(self.scraper_data)
self.peviitor_jobs_data = TestUtils.scrape_peviitor('splendor', 'România')

def test_splendor(self, get_data):
"""
Test the splendor website against the pe viitor data
"""
# Test Title
assert sorted(self.scraped_jobs_data[0]) == sorted(self.peviitor_jobs_data[0])
# Test job city
assert sorted(self.scraped_jobs_data[1]) == sorted(self.peviitor_jobs_data[1])
# Test job country
assert sorted(self.scraped_jobs_data[2]) == sorted(self.peviitor_jobs_data[2])
# Test job link
assert sorted(self.scraped_jobs_data[3]) == sorted(self.peviitor_jobs_data[3])

0 comments on commit 9272e37

Please sign in to comment.