예제 #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])
예제 #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])
예제 #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])
예제 #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])
예제 #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])
예제 #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])
예제 #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])
예제 #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])
예제 #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])
예제 #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)
예제 #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])
예제 #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)
예제 #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])
    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])
예제 #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])
예제 #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])
예제 #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')
예제 #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'))
예제 #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]) 
예제 #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])
예제 #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])
예제 #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])
예제 #26
0
파일: app_test.py 프로젝트: johnddiaz/blog
    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])