def test(self, template): with mock.patch("github_board.open", mock.mock_open(read_data=template), create=True): with mock.patch("github_board.pygit2.Repository.create_commit", mock.Mock()) as m: main("test@test", self.repo.path, template, None) self.assertEquals(sum([int(i) for i in template if i.isdigit()]), len(m.mock_calls))
def test(self, content, expected_result): with mock.patch("github_board.open", mock.mock_open(read_data=content), create=True): self.assertListEqual(expected_result, load_template("fake_path"))