def test_show(server_with_data):
    timestamp = server_with_data.cloneable_with_commits.commits[0].date
    resp = server_with_data.server.client.get(flask.url_for(
        'graph.show',
        metric_name=PythonImportCount.__name__,
        start=five.text(timestamp - 1000),
        end=five.text(timestamp + 1000),
    ))
    assert_no_response_errors(resp)
def test_show(server_with_data):
    timestamp = server_with_data.cloneable_with_commits.commits[0].date
    resp = server_with_data.server.client.get(flask.url_for(
        'graph.show',
        metric_name=PythonImportCount.__name__,
        start=five.text(timestamp - 1000),
        end=five.text(timestamp + 1000),
    ))
    assert_no_response_errors(resp)
def test_get_commits_all_of_them(checked_out_repo):
    with mock.patch.object(repo_parser, 'cmd_output') as cmd_output_mock:
        commit = repo_parser.Commit('sha', 123)
        cmd_output_mock.return_value = '\n'.join(
            five.text(part) for part in commit) + '\n'
        all_commits = checked_out_repo.repo_parser.get_commits()
        assert all_commits == [commit]
def test_get_commits_all_of_them(checked_out_repo):
    with mock.patch.object(repo_parser, 'cmd_output') as cmd_output_mock:
        commit = repo_parser.Commit('sha', 123)
        cmd_output_mock.return_value = '\n'.join(
            five.text(part) for part in commit
        ) + '\n'
        all_commits = checked_out_repo.repo_parser.get_commits()
        assert all_commits == [commit]
def test_get_commits_after_date(checked_out_repo):
    with mock.patch.object(repo_parser, 'cmd_output') as cmd_output_mock:
        previous_sha = '29d0d321f43950fd2aa1d1df9fc81dee0e9046b3'
        commit = repo_parser.Commit(previous_sha, 123)
        cmd_output_mock.return_value = '\n'.join(
            five.text(part) for part in commit) + '\n'
        checked_out_repo.repo_parser.get_commits(previous_sha)
        assert ('{0}..HEAD'.format(previous_sha)
                in cmd_output_mock.call_args[0])
def test_get_commits_after_date(checked_out_repo):
    with mock.patch.object(repo_parser, 'cmd_output') as cmd_output_mock:
        previous_sha = '29d0d321f43950fd2aa1d1df9fc81dee0e9046b3'
        commit = repo_parser.Commit(previous_sha, 123)
        cmd_output_mock.return_value = '\n'.join(
            five.text(part) for part in commit
        ) + '\n'
        checked_out_repo.repo_parser.get_commits(previous_sha)
        assert (
            '{0}..HEAD'.format(previous_sha) in
            cmd_output_mock.call_args[0]
        )
 def get(self):
     path = os.path.join(tmpdir.strpath, five.text(self.tmpdir_count))
     self.tmpdir_count += 1
     os.mkdir(path)
     return path
 def get(self):
     path = os.path.join(tmpdir.strpath, five.text(self.tmpdir_count))
     self.tmpdir_count += 1
     os.mkdir(path)
     return path