From ac6338ba5be9a415721b719807ab98a24fad093f Mon Sep 17 00:00:00 2001 From: tdhood Date: Fri, 21 Apr 2023 14:44:03 -0700 Subject: [PATCH] added testing for new mexico --- tests/test_new_mexico.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 tests/test_new_mexico.py diff --git a/tests/test_new_mexico.py b/tests/test_new_mexico.py new file mode 100644 index 0000000..ab7820d --- /dev/null +++ b/tests/test_new_mexico.py @@ -0,0 +1,20 @@ +import unittest +import requests + +from lottery_data_scraper import new_mexico +from lottery_data_scraper import schemas + +class TestNewMexico(unittest.TestCase): + def test_parse_game_html(self): + # URL chosen arbitrarily + url = "https://www.nmlottery.com/games/scratchers" + html = new_mexico.fetch_html(url) + game = new_mexico.get_games(url)[0] + game = new_mexico.process_game(game) + self.assertEqual(game["name"], "$5,000 ORO") + self.assertEqual(game["price"], 2) + self.assertEqual(game["game_id"], "545") + self.assertEqual(game["prizes"][0]["prize"], "$5,000") + # Perhaps unfortunately in dollars. Cents would be better, eh? + self.assertEqual(game["prizes"][0]["value"], 5000) + self.assertEqual(game["num_tx_initial"], 498000)