Beispiel #1
0
  def test_get_log_with_path_with_space(self):
    req_path = 'project/+log/master/x%20y'
    self.mock_fetch_json(None)

    gitiles.get_log(HOSTNAME, 'project', 'master', path='x y')
    gerrit.fetch_json_async.assert_called_once_with(
        HOSTNAME, req_path, params={})
Beispiel #2
0
  def test_get_log_with_path(self):
    req_path = 'project/+log/master/x'
    self.mock_fetch_json(None)

    gitiles.get_log(HOSTNAME, 'project', 'master', path='x', limit=2)
    gerrit.fetch_json_async.assert_called_once_with(
        HOSTNAME, req_path, params={'n': 2})
Beispiel #3
0
  def test_get_log_with_path(self):
    req_path = 'project/+log/master/x'
    gerrit.fetch_json.return_value = None

    gitiles.get_log(HOSTNAME, 'project', 'master', path='x', limit=2)
    gerrit.fetch_json.assert_called_once_with(
        HOSTNAME, req_path, params={'n': 2})
Beispiel #4
0
    def test_get_log_with_path(self):
        req_path = 'project/+log/master/x'
        gerrit.fetch_json.return_value = None

        gitiles.get_log(HOSTNAME, 'project', 'master', path='x', limit=2)
        gerrit.fetch_json.assert_called_once_with(HOSTNAME,
                                                  req_path,
                                                  params={'n': 2})
Beispiel #5
0
    def test_get_log(self):
        req_path = 'project/+log/master/'
        gerrit.fetch_json.return_value = {
            'log': [
                {
                    'commit': REVISION,
                    'tree': '3cfb41e1c6c37e61c3eccfab2395752298a5743c',
                    'parents': [
                        '4087678c002d57e1148f21da5e00867df9a7d973',
                    ],
                    'author': {
                        'name': 'John Doe',
                        'email': '*****@*****.**',
                        'time': 'Tue Apr 29 00:00:00 2014',
                    },
                    'committer': {
                        'name': 'John Doe',
                        'email': '*****@*****.**',
                        'time': 'Tue Apr 29 00:00:00 2014',
                    },
                    'message': 'Subject\\n\\nBody',
                },
                {
                    'commit': '4087678c002d57e1148f21da5e00867df9a7d973',
                    'tree': '3cfb41asdc37e61c3eccfab2395752298a5743c',
                    'parents': [
                        '1237678c002d57e1148f21da5e00867df9a7d973',
                    ],
                    'author': {
                        'name': 'John Doe',
                        'email': '*****@*****.**',
                        'time': 'Tue Apr 29 00:00:00 2014',
                    },
                    'committer': {
                        'name': 'John Doe',
                        'email': '*****@*****.**',
                        'time': 'Tue Apr 29 00:00:00 2014',
                    },
                    'message': 'Subject2\\n\\nBody2',
                },
            ],
        }

        log = gitiles.get_log(HOSTNAME, 'project', 'master', limit=2)
        gerrit.fetch_json.assert_called_once_with(HOSTNAME,
                                                  req_path,
                                                  params={'n': 2})

        john = gitiles.Contribution(name='John Doe',
                                    email='*****@*****.**',
                                    time=datetime.datetime(2014, 4, 29))
        self.assertEqual(
            log,
            gitiles.Log(commits=[
                gitiles.Commit(
                    sha=REVISION,
                    tree='3cfb41e1c6c37e61c3eccfab2395752298a5743c',
                    parents=[
                        '4087678c002d57e1148f21da5e00867df9a7d973',
                    ],
                    message='Subject\\n\\nBody',
                    author=john,
                    committer=john,
                ),
                gitiles.Commit(
                    sha='4087678c002d57e1148f21da5e00867df9a7d973',
                    tree='3cfb41asdc37e61c3eccfab2395752298a5743c',
                    parents=[
                        '1237678c002d57e1148f21da5e00867df9a7d973',
                    ],
                    message='Subject2\\n\\nBody2',
                    author=john,
                    committer=john,
                ),
            ]))
Beispiel #6
0
    def test_get_log_with_path_with_space(self):
        req_path = "project/+log/master/x%20y"
        self.mock_fetch_json(None)

        gitiles.get_log(HOSTNAME, "project", "master", path="x y")
        gerrit.fetch_json_async.assert_called_once_with(HOSTNAME, req_path, params={})
Beispiel #7
0
    def test_get_log_with_path(self):
        req_path = "project/+log/master/x"
        self.mock_fetch_json(None)

        gitiles.get_log(HOSTNAME, "project", "master", path="x", limit=2)
        gerrit.fetch_json_async.assert_called_once_with(HOSTNAME, req_path, params={"n": 2})
Beispiel #8
0
    def test_get_log(self):
        req_path = "project/+log/master/"
        self.mock_fetch_json(
            {
                "log": [
                    {
                        "commit": REVISION,
                        "tree": "3cfb41e1c6c37e61c3eccfab2395752298a5743c",
                        "parents": ["4087678c002d57e1148f21da5e00867df9a7d973"],
                        "author": {
                            "name": "John Doe",
                            "email": "*****@*****.**",
                            "time": "Tue Apr 29 00:00:00 2014",
                        },
                        "committer": {
                            "name": "John Doe",
                            "email": "*****@*****.**",
                            "time": "Tue Apr 29 00:00:00 2014",
                        },
                        "message": "Subject\\n\\nBody",
                        "tree_diff": [],
                    },
                    {
                        "commit": "4087678c002d57e1148f21da5e00867df9a7d973",
                        "tree": "3cfb41asdc37e61c3eccfab2395752298a5743c",
                        "parents": ["1237678c002d57e1148f21da5e00867df9a7d973"],
                        "author": {
                            "name": "John Doe",
                            "email": "*****@*****.**",
                            "time": "Tue Apr 29 00:00:00 2014",
                        },
                        "committer": {
                            "name": "John Doe",
                            "email": "*****@*****.**",
                            "time": "Tue Apr 29 00:00:00 2014",
                        },
                        "message": "Subject2\\n\\nBody2",
                        "tree_diff": [],
                    },
                ]
            }
        )

        log = gitiles.get_log(HOSTNAME, "project", "master", limit=2)
        gerrit.fetch_json_async.assert_called_once_with(HOSTNAME, req_path, params={"n": 2})

        john = gitiles.Contribution(name="John Doe", email="*****@*****.**", time=datetime.datetime(2014, 4, 29))
        self.assertEqual(
            log,
            gitiles.Log(
                commits=[
                    gitiles.Commit(
                        sha=REVISION,
                        tree="3cfb41e1c6c37e61c3eccfab2395752298a5743c",
                        parents=["4087678c002d57e1148f21da5e00867df9a7d973"],
                        message="Subject\\n\\nBody",
                        author=john,
                        committer=john,
                        tree_diff=[],
                    ),
                    gitiles.Commit(
                        sha="4087678c002d57e1148f21da5e00867df9a7d973",
                        tree="3cfb41asdc37e61c3eccfab2395752298a5743c",
                        parents=["1237678c002d57e1148f21da5e00867df9a7d973"],
                        message="Subject2\\n\\nBody2",
                        author=john,
                        committer=john,
                        tree_diff=[],
                    ),
                ],
                next_cursor=None,
            ),
        )
Beispiel #9
0
  def test_get_log(self):
    req_path = 'project/+log/master/'
    self.mock_fetch_json({
      'log': [
        {
          'commit': REVISION,
          'tree': '3cfb41e1c6c37e61c3eccfab2395752298a5743c',
          'parents': [
            '4087678c002d57e1148f21da5e00867df9a7d973',
          ],
          'author': {
            'name': 'John Doe',
            'email': '*****@*****.**',
            'time': 'Tue Apr 29 00:00:00 2014',
          },
          'committer': {
            'name': 'John Doe',
            'email': '*****@*****.**',
            'time': 'Tue Apr 29 00:00:00 2014',
          },
          'message': 'Subject\\n\\nBody',
          'tree_diff': [],
        },
        {
          'commit': '4087678c002d57e1148f21da5e00867df9a7d973',
          'tree': '3cfb41asdc37e61c3eccfab2395752298a5743c',
          'parents': [
            '1237678c002d57e1148f21da5e00867df9a7d973',
          ],
          'author': {
            'name': 'John Doe',
            'email': '*****@*****.**',
            'time': 'Tue Apr 29 00:00:00 2014',
          },
          'committer': {
            'name': 'John Doe',
            'email': '*****@*****.**',
            'time': 'Tue Apr 29 00:00:00 2014',
          },
          'message': 'Subject2\\n\\nBody2',
          'tree_diff': [],
        },
      ],
    })

    log = gitiles.get_log(HOSTNAME, 'project', 'master', limit=2)
    gerrit.fetch_json_async.assert_called_once_with(
        HOSTNAME, req_path, params={'n': 2})

    john = gitiles.Contribution(
        name='John Doe', email='*****@*****.**',
        time=datetime.datetime(2014, 4, 29))
    self.assertEqual(
        log,
        gitiles.Log(
            commits=[
              gitiles.Commit(
                  sha=REVISION,
                  tree='3cfb41e1c6c37e61c3eccfab2395752298a5743c',
                  parents=[
                    '4087678c002d57e1148f21da5e00867df9a7d973',
                  ],
                  message='Subject\\n\\nBody',
                  author=john,
                  committer=john,
                  tree_diff=[],
              ),
              gitiles.Commit(
                  sha='4087678c002d57e1148f21da5e00867df9a7d973',
                  tree='3cfb41asdc37e61c3eccfab2395752298a5743c',
                  parents=[
                    '1237678c002d57e1148f21da5e00867df9a7d973',
                  ],
                  message='Subject2\\n\\nBody2',
                  author=john,
                  committer=john,
                  tree_diff=[],
              ),
            ],
            next_cursor=None,
        )
    )