Esempio n. 1
0
    def test_menu_calls_ask_create_post(self):
        with patch('builtins.input') as mocked_input:
            with patch('section3.video_code.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()
Esempio n. 2
0
    def test_menu_calls_print_blogs(self):
        with patch('builtins.input') as mocked_input:
            with patch('section3.video_code.app.print_blogs') as mocked_print_blogs:
                mocked_input.side_effect = ('l', 'q')
                app.menu()

                mocked_print_blogs.assert_called()
Esempio n. 3
0
    def test_menu_calls_ask_read_blogs(self):
        with patch('builtins.input') as mocked_input:
            with patch('section3.video_code.app.ask_read_blog') as mocked_ask_read_blog:
                mocked_input.side_effect = ('r', 'Test', 'q')
                app.menu()

                mocked_ask_read_blog.assert_called()
Esempio n. 4
0
    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'])
Esempio n. 5
0
    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)')
Esempio n. 6
0
    def test_menu_calls_ask_read_blogs(self):
        with patch('builtins.input') as mocked_input:
            with patch('section3.video_code.app.ask_read_blog'
                       ) as mocked_ask_read_blog:
                mocked_input.side_effect = ('r', 'Test', 'q')
                app.menu()

                mocked_ask_read_blog.assert_called()
Esempio n. 7
0
    def test_menu_calls_print_blogs(self):
        with patch('builtins.input') as mocked_input:
            with patch('section3.video_code.app.print_blogs'
                       ) as mocked_print_blogs:
                mocked_input.side_effect = ('l', 'q')
                app.menu()

                mocked_print_blogs.assert_called()
Esempio n. 8
0
    def test_menu_calls_ask_create_post(self):
        with patch('builtins.input') as mocked_input:
            with patch('section3.video_code.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()
Esempio n. 9
0
    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'])
Esempio n. 10
0
    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)
Esempio n. 11
0
    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)')
Esempio n. 12
0
    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)