def test_menu_option_4(self, mock_stdout, *args): # find_deals_from_user app = PyMkmApp(self.config) with self.assertLogs(level="DEBUG") as cm: app.start() log_record = cm.records[len(cm.records) - 1] self.assertRegex(log_record.message, r"find_deals_from_user")
def main(): parser = argparse.ArgumentParser( description="pymkm command line interface.") parser.add_argument("--version", action="version", version=__version__) parser.add_argument( "--update_stock", action="store_true", help="Update stock prices. Use --partial if needed.", ) parser.add_argument( "--partial", metavar="<number>", type=int, default=0, help="Used for partial updates of for example stock.", ) parser.add_argument( "--price_check_wantslist", metavar="<wantslist name>", type=str, help="Run the Track price data to csv option.", ) parser.add_argument( "--cached", type=bool, default=False, help="Use cached values if available (defaults to False).", ) args = parser.parse_args() app = PyMkmApp() app.start(args)
def test_menu_option_9_1_match(self, mock_open, mock_stdout, *args): app = PyMkmApp(self.config) with self.assertLogs(level="DEBUG") as cm: app.start() log_record = cm.records[len(cm.records) - 1] self.assertRegex(log_record.message, r"import_from_csv:")
def test_menu_option_8(self, *args): # clear_entire_stock app = PyMkmApp(self.config) with self.assertLogs(level="DEBUG") as cm: app.start() log_record = cm.records[len(cm.records) - 1] self.assertRegex(log_record.message, r"clear_entire_stock")
def test_menu_option_5(self, mock_stdout, *args): # show_top_expensive_articles_in_stock app = PyMkmApp(self.config) app.start() text = mock_stdout.getvalue() self.assertRegex(mock_stdout.getvalue(), r"Top 20 most expensive articles in stock:")
def test_stock_update(self, mock_stdin, mock_stdout, *args): self.assertEqual(True, True) app = PyMkmApp() app.start(self.parsed_args) out = mock_stdout.getvalue() self.assertRegex(out, r"API calls used today")
def test_menu_option_6(self, mock_stdout, *args): # clean_purchased_from_wantslists app = PyMkmApp(self.config) app.start() print(mock_stdout.getvalue()) self.assertRegex(mock_stdout.getvalue(), r"This will show items in your ")
def test_menu_option_2(self, mock_open, mock_stdout, *args): # update_product_to_trend app = PyMkmApp(self.config) with self.assertLogs(level="DEBUG") as cm: app.start() log_record = cm.records[len(cm.records) - 1] self.assertRegex(log_record.message, r"update_product_to_trend")
def test_menu_option_3(self, mock_stdout, *args): # list_competition_for_product app = PyMkmApp(self.config) with self.assertLogs(level="DEBUG") as cm: app.start() log_record = cm.records[len(cm.records) - 1] self.assertRegex(log_record.message, r"list_competition_for_product")
def test_menu_option_7(self, mock_stdout, *args): # show_account_info app = PyMkmApp(self.config) # app.start() # self.assertRegex(mock_stdout.getvalue(), r"{'account':") with self.assertLogs(level="DEBUG") as cm: app.start() log_record = cm.records[len(cm.records) - 1] self.assertRegex(log_record.message, r"show_account_info")
def main(): app = PyMkmApp() app.start()
def test_main_menu(self, mock_input, mock_stdout, *args): app = PyMkmApp(self.config) app.start() self.assertRegex(mock_stdout.getvalue(), r"╭─── PyMKM")
def test_app_starts(self, mock_input, mock_stdout, *args): self.assertEqual(True, True) app = PyMkmApp() app.start(self.parsed_args) self.assertRegex(mock_stdout.getvalue(), r"╭─── PyMKM")
def test_menu_option_7(self, mock_stdout, *args): # show_account_info app = PyMkmApp(self.config) app.start() print(mock_stdout.getvalue()) self.assertRegex(mock_stdout.getvalue(), r"{'account':")