Exemple #1
0
class TestPostMaker:
    def setup(self):
        self.posts = mock.create_autospec(PostRepositoryABC)
        self.maker = PostMaker(posts=self.posts, clock=self.clock)

    def test_create_new_draft_post_persists(self):
        self.maker.create_draft(title='Fhtagn Daaz',
                                author=object(),
                                text='Introducing Grape Old Ones')

        assert self.posts.persist.call_count == 1

    def test_create_published_post_persists(self, clock):
        self.maker.create_published(title='Fhtagn Daaz',
                                    author=object(),
                                    text='Introducing Grape Old Ones')

        self.posts.persist.call_count == 1

    def test_create_scheduled_post_persists(self, clock):
        self.maker.schedule_post(title='Fhtagn Daaz',
                                 author=object(),
                                 text='Introducing Grape Old Ones',
                                 when=datetime(2015, 10, 12))

        assert self.posts.persist.call_count == 1
Exemple #2
0
class TestPostMaker:
    def setup(self):
        self.posts = mock.create_autospec(PostRepositoryABC)
        self.maker = PostMaker(posts=self.posts, clock=self.clock)

    def test_create_new_draft_post_persists(self):
        self.maker.create_draft(title='Fhtagn Daaz', author=object(),
                                text='Introducing Grape Old Ones')

        assert self.posts.persist.call_count == 1

    def test_create_published_post_persists(self, clock):
        self.maker.create_published(title='Fhtagn Daaz', author=object(),
                                    text='Introducing Grape Old Ones')

        self.posts.persist.call_count == 1

    def test_create_scheduled_post_persists(self, clock):
        self.maker.schedule_post(title='Fhtagn Daaz', author=object(),
                                 text='Introducing Grape Old Ones',
                                 when=datetime(2015, 10, 12))

        assert self.posts.persist.call_count == 1
Exemple #3
0
 def setup(self):
     self.posts = mock.create_autospec(PostRepositoryABC)
     self.maker = PostMaker(posts=self.posts, clock=self.clock)
Exemple #4
0
 def setup(self):
     self.posts = mock.create_autospec(PostRepositoryABC)
     self.maker = PostMaker(posts=self.posts, clock=self.clock)