예제 #1
0
    def test_division_suffix(self, mocker):
        description = mocker.PropertyMock(return_value="Foo Bar Division")
        mocker.patch.object(Post, "division_description", new=description)
        post = PostFactory.build()

        assert post.division_suffix == "division"
        description.assert_called_once()
예제 #2
0
    def test_division_description(self, division_type, description):
        """
        Test that for each division type choice, the correct description is
        returned
        """
        post = PostFactory.build(division_type=division_type)

        assert post.division_description == description
예제 #3
0
 def test_full_label(self, mocker):
     suffix = mocker.PropertyMock(return_value="ward")
     mocker.patch.object(Post, "division_suffix", new=suffix)
     post = PostFactory.build(label="Ecclesall")
     assert post.full_label == "Ecclesall ward"
     suffix.assert_called_once()