WayneRose-95 / Metacritic_Webscraper-

A side project on creating my own first web scraper.
GNU General Public License v3.0
0 stars 0 forks source link

Testing _save_json and accept_cookies methods #15

Open WayneRose-95 opened 2 years ago

WayneRose-95 commented 2 years ago

A new method, _save_json has been added, and the accept_cookies method has been adjusted to become more robust across other websites.

New accept_cookies method has been refactored:

New Git Issue Code

For the above method, a suitable unit-test must be written to test its robustness across multiple websites.

And the _save_json method:

save_json method

Both of these methods need to be unit-tested in order to test their robustness.

After which, the _save_json method needs to be implemented within the main method of the scraper.

When unit-testing the _save_json method, the goal is to convert an output into a .json file.

An output such as this:

Sample Scraper Output

Should be converted into a .json file and a new directory should be made to accommodate said files.

However, while testing the method, the following error occurs:

That said, the directory is created and the file name is also named accordingly.

Git Issue Error

This error must be debugged in order to satisfy the unit-test conditions.

WayneRose-95 commented 2 years ago

The .json error has now been debugged, and the file creates a valid .json file using the sample_text_output file.

Moving onto the accept_cookies and .csv methods.

Potentially, the .csv and .json methods could be encapsulated into one method.