def test_menu_calls_ask_read_blogs(self): with patch('builtins.input') as mocked_input: with patch('tests.app.ask_read_blog') as mocked_ask_read_blog: mocked_input.side_effect = ('r', 'Test', 'q') app.menu() mocked_ask_read_blog.assert_called()
def test_menu_calls_print_blogs(self): with patch('builtins.input') as mocked_input: with patch('tests.app.print_blogs') as mocked_print_blogs: mocked_input.side_effect = ('l', 'q') app.menu() mocked_print_blogs.assert_called()
def test_menu_calls_create_blog(self): with patch('builtins.input') as mocked_input: mocked_input.side_effect = ('c', 'Test Two', 'Test Author Two', 'q') app.menu() self.assertIsNotNone(app.blogs['Test Two'])
def test_menu_prints_blogs(self): with patch('builtins.print') as mocked_print: with patch('builtins.input', return_value='q'): app.menu() mocked_print.assert_called_with( '- Test by Test Author (0 posts)')
def test_menu_calls_ask_create_post(self): with patch('builtins.input') as mocked_input: with patch('tests.app.ask_create_post') as mocked_ask_create_post: mocked_input.side_effect = ('p', 'Test', 'New Post', 'New Content', 'q') app.menu() mocked_ask_create_post.assert_called()
def test_menu_prints_prompt(self): with patch('builtins.input', return_value='q') as mocked_input: app.menu() mocked_input.assert_called_with(app.MENU_PROMPT)