Exemplo n.º 1
0
    def test_print_posts(self):
        blog = app.Blogs[BLOG_TITLE]
        blog.create_post(POST_TITLE, POST_CONTENT)
        with patch('app._print_post_') as mocked_print_post:
            app.print_posts(blog)

            mocked_print_post.assert_called_with(blog.posts[0])
Exemplo n.º 2
0
 def test_print_posts(self):
     blog = Blog("Test", "Test author")
     blog.create_post("Title_post", "Content")
     app.blogs = {"Test": blog}
     with patch('app.print_post') as mocked_print_post:
         app.print_posts(blog)
         mocked_print_post.assert_called_with(blog.posts[0])
    def test_print_posts(self):
        blog = app.blogs["Test"]
        blog.create_post("Test Post", "Test Content")

        with patch("app.print_post") as mocked_print_post:
            app.print_posts(blog)
            mocked_print_post.assert_called_with(blog.posts[1])
Exemplo n.º 4
0
    def test_print_posts(self):
        blog = app.blogs['Test']
        blog.create_post('Test post', 'Test content')
        with patch('app.print_post') as mocked_print_post:
            app.print_posts(blog)

            mocked_print_post.assert_called_with(blog.posts[0])
Exemplo n.º 5
0
 def test_print_posts(self):
     blog = Blog('Blog Title', "Blog Author")
     blog.create_post('Test Post', "Test Content")
     app.blogs = {'Blog Title': blog}
     with patch('app.print_post') as mocked_print_post:
         app.print_posts(blog)
         mocked_print_post.assert_called_with(blog.posts[0])
Exemplo n.º 6
0
 def test_print_posts(self):
     blog = Blog('Test', 'Test Author')
     blog.create_post('Test', 'Test Content')
     app.blogs = {'Test': blog}
     with patch('app.print_post') as mocked_print_post:
         app.print_posts(app.blogs['Test'])
         mocked_print_post.assert_called_with(blog.posts[0])
Exemplo n.º 7
0
 def test_print_posts(self):
     b = Blog('Test', 'Test Author')
     b.create_post('Test Post', 'Test Post Content')
     app.blogs = {'Test': b}
     with patch('app.print_one_post') as mocked_print_post:
         app.print_posts(b)
         mocked_print_post.assert_called_with(b.posts[0])
Exemplo n.º 8
0
    def test_print_posts(self):
        blog = app.blogs['Test']

        with patch('app.print_post') as mocked_print_post:
            app.print_posts(blog)

            mocked_print_post.assert_called_with(blog.posts[0])
Exemplo n.º 9
0
 def test_print_posts(self):
     title = 'Test Blog'
     blog = Blog(title, 'Test Author')
     blog.create_post('Test Post', 'Test Content')
     app.blogs = {title: blog}
     with patch('app.print_post') as mocked_print_post:
         app.print_posts(blog)
         mocked_print_post.assert_called_with(blog.posts[0])
Exemplo n.º 10
0
    def test_print_posts(self):
        blog = Blog("automation", "Clark")
        blog.create_post("selenium", "one of automation tools")
        app.blogs = dict({"automation": blog})

        with patch("application.print_post") as mocked_print_post:
            app.print_posts(blog)
            mocked_print_post.assert_called_with(blog.posts[0])
Exemplo n.º 11
0
    def test_print_posts(self):
        blog = app.blogs['Test Blog']
        post = {'title': 'Test Post 1', 'content': 'Test Post 2'}
        blog.posts.append({'title': 'Test Post 1', 'content': 'Test Post 2'})

        with patch('app.print_post') as mocked_print_post:
            app.print_posts(blog)
            mocked_print_post.assert_called_with(post)
Exemplo n.º 12
0
    def test_print_posts(self):
        blog = app.blogs['Test']
        app.blogs = {'Test': blog}

        with patch("app.print_post") as mocked_print_posts:
            app.print_posts(blog)

            mocked_print_posts.assert_called_with(blog.posts[0])
Exemplo n.º 13
0
    def test_print_posts(self):
        test_blog = app.blogs["Test"]
        post = test_blog.create_post("Test Post", "Test Content")
        test_blog.posts.append(post)
        with patch("app.print_posts") as mocked_print_posts:
            app.print_posts(test_blog)

            mocked_print_posts.assert_called_with(test_blog)
Exemplo n.º 14
0
    def test_print_posts(self):
        blog = app.blogs['Test']
        blog.create_post('Post title', 'Post content')

        with patch('section3.video_code.app.print_post') as mocked_print_post:
            app.print_posts(blog)

            mocked_print_post.assert_called_with(blog.posts[0])
Exemplo n.º 15
0
    def test_print_posts(self):
        blog = Blog("Test", "Sergiy Mushtyn")
        blog.create_post('Test Post', 'Test Content')
        app.blogs = {'Test': blog}

        with patch('app.print_post') as mocked_print_post:
            app.print_posts(blog)
            mocked_print_post.assert_called_with(blog.posts[0])
Exemplo n.º 16
0
 def test_print_posts(self):
     # b = Blog('Blog Title', 'Blog aUthor')
     app.blogs['Blog Title'].create_post('Test Post Title',
                                         'Test Post Content')
     #app.blogs = {'Blog Title': app.blogs['Blog Title']}
     with patch('app.print_post') as mocked_print_post:
         app.print_posts(app.blogs['Blog Title'])
         mocked_print_post.assert_called_with(
             app.blogs['Blog Title'].posts[0])
Exemplo n.º 17
0
    def test_print_posts(self):
        blog = app.blogs["Test"]
        blog.create_post("Test Post", "Test Content")
        app.blogs = {"Test": blog}

        with patch("app.print_post") as mocked_print_post:
            app.print_posts(blog)

            mocked_print_post.assert_called_with(blog.posts[0])
Exemplo n.º 18
0
    def test_ask_create_post(self):
        blog = app.blogs['Test']
        app.print_posts(blog)
        with patch('builtins.input') as mocked_input:
            mocked_input.side_effect = ('Test', 'Post Title', 'Post Content')
            app.ask_create_post()

            self.assertEqual(blog.posts[0].title, 'Post Title')
            self.assertEqual(blog.posts[0].content, 'Post Content')
Exemplo n.º 19
0
 def test_print_post(self):
     # b = Blog('Blog Title', 'Blog aUthor')
     app.blogs['Blog Title'].create_post('Test Post Title',
                                         'Test Post Content')
     #app.blogs = {'Blog Title': app.blogs['Blog Title']}
     with patch('builtins.print') as mocked_print:
         app.print_posts(app.blogs['Blog Title'])
         mocked_print.assert_called_with(
             app.POST_TEMPLATE.format('Test Post Title',
                                      'Test Post Content'))
Exemplo n.º 20
0
 def test_print_posts(self):
     blog = app.blogs["Test"]
     # blog = Blog("Test", "Test Author")
     blog.create_post("Test Post", "Test Content")
     # app.blogs = {"Test": blog}
     
     with patch("app.print_post") as mocked_print_post:
         app.print_posts(blog)   
         
         mocked_print_post.assert_called_with(blog.posts[0]) 
Exemplo n.º 21
0
    def test_print_posts(self):
        """
        Testing to see if the print_post() is called. We call print_posts() since it calls this function.

        """
        blog = app.blogs['Test']
        blog.create_post('Test Post', 'Test Content')

        with patch('app.print_post') as mocked_print_post:
            app.print_posts(blog)

            mocked_print_post.assert_called_with(blog.posts[0])
Exemplo n.º 22
0
    def test_print_posts(self):
        """
        This is a test for print_posts function
        """
        blog = Blog("My days", "RW")
        blog.create_post('Post 1', 'This is my first post')
        blog.create_post('Post 2', 'This is my second post')
        app.blogs.update({"My days": blog})

        with patch('app.print_post') as mocked_print_post:
            app.print_posts(blog)

            mocked_print_post.assert_called_with(blog.posts[1])
    def test_print_posts(
        self
    ):  # In this test we gonna check is in the print_posts function, the another print_post(post) is called or not

        # Now we have to create a blog post with Title and Author
        #blog = Blog('Test', 'Author')
        # Now create a blog post
        self.blog.create_post('Test Post', 'Test Content')
        # Here we have to create a dictionary which key is 'Test-Blog' and value is the blog object
        app.blogs = {'Test': self.blog}
        # And here we gonna check 'print_post(post) is called or not
        with patch('app.print_post') as mocked_print_post:
            app.print_posts(
                self.blog
            )  # we have to call the print_posts(blog) function first, because print_post(post) is inside this function
            mocked_print_post.assert_called_with(self.blog.posts[0])
Exemplo n.º 24
0
 def test_print_posts(self):
     post = Post("post", "Test Content")
     app.blogs['Test'].add_post(post, '')
     with patch('app.print_post') as mocked_blog:
         app.print_posts(app.blogs["Test"])
     mocked_blog.assert_called_with(app.blogs["Test"].posts[0])
    def test_print_posts(self):
        with patch('app.print_post') as mocked_print_post:
            app.print_posts(app.blogs['Test Blog'])

            mocked_print_post.assert_called_with(
                app.blogs['Test Blog'].posts[0])
Exemplo n.º 26
0
    def test_print_posts(self):
        app.blogs['Test'].create_post('Post Title', 'Post Content')
        with patch('app.print_post') as mocked_print_post:
            app.print_posts(app.blogs['Test'])

            mocked_print_post.assert_called_with(app.blogs['Test'].posts[0])