Пример #1
0
    def test_conversion_to_commit_multiple(self):
        my_repo = model_helpers.create_repo()
        my_repo.put()
        my_commit = model_helpers.create_commit()
        my_commit.put()
        commit_json = {
            'commit':
            'deadbeef' * 5,
            'message':
            'This is a revert\n'
            'Original message\n'
            'Cr-Commit-Position: refs/heads/master@{#298664}\n'
            'More stuff\n'
            'Cr-Commit-Position: refs/heads/master@{#298668}',
        }

        controller.write_commits_to_db([commit_json], 'cool', 'cool_src')
        commit = models.NumberingMap.get_key_by_id(
            298668,
            models.NumberingType.COMMIT_POSITION,
            repo='cool_src',
            project='cool',
            ref='refs/heads/master').get()
        self.assertIsNotNone(commit)
        commit = models.NumberingMap.get_key_by_id(
            298664,
            models.NumberingType.COMMIT_POSITION,
            repo='cool_src',
            project='cool',
            ref='refs/heads/master').get()
        self.assertIsNone(commit)
Пример #2
0
  def test_conversion_to_commit_multiple(self):
    my_repo = model_helpers.create_repo()
    my_repo.put()
    my_commit = model_helpers.create_commit()
    my_commit.put()
    commit_json = {
        'commit': 'deadbeef' * 5,
        'message': 'This is a revert\n'
                   'Original message\n'
                   'Cr-Commit-Position: refs/heads/master@{#298664}\n'
                   'More stuff\n'
                   'Cr-Commit-Position: refs/heads/master@{#298668}',
    }

    controller.write_commits_to_db( [commit_json], 'cool', 'cool_src')
    commit = models.NumberingMap.get_key_by_id(
        298668,
        models.NumberingType.COMMIT_POSITION,
        repo='cool_src',
        project='cool',
        ref='refs/heads/master').get()
    self.assertIsNotNone(commit)
    commit = models.NumberingMap.get_key_by_id(
        298664,
        models.NumberingType.COMMIT_POSITION,
        repo='cool_src',
        project='cool',
        ref='refs/heads/master').get()
    self.assertIsNone(commit)
Пример #3
0
 def test_conversion_to_no_commit(self):
     my_repo = model_helpers.create_repo()
     my_repo.put()
     my_commit = model_helpers.create_commit()
     my_commit.put()
     commit_json = {
         'commit': 'deadbeef' * 5,
         'message': '',
     }
     controller.write_commits_to_db([commit_json], 'cool', 'cool_src')
     self.assertEqual(0, len(list(models.NumberingMap.query())))
Пример #4
0
 def test_conversion_to_no_commit(self):
   my_repo = model_helpers.create_repo()
   my_repo.put()
   my_commit = model_helpers.create_commit()
   my_commit.put()
   commit_json = {
       'commit': 'deadbeef' * 5,
       'message': '',
   }
   controller.write_commits_to_db( [commit_json], 'cool', 'cool_src')
   self.assertEqual(0, len(list(models.NumberingMap.query())))
Пример #5
0
    def test_conversion_to_svn_commit(self):
        my_repo = model_helpers.create_repo()
        my_repo.put()
        my_commit = model_helpers.create_commit()
        my_commit.put()
        commit_json = {
            'commit':
            'deadbeef' * 5,
            'message':
            'git-svn-id: svn://svn.chromium.org/chrome/trunk/src@200000 '
            '0039d316-1c4b-4281-b951-d872f2087c98',
        }

        controller.write_commits_to_db([commit_json], 'cool', 'cool_src')
        for ref in ('svn://svn.chromium.org/chrome',
                    'svn://svn.chromium.org/chrome/trunk',
                    'svn://svn.chromium.org/chrome/trunk/src'):
            commit = models.NumberingMap.get_key_by_id(
                200000, models.NumberingType.SVN, ref=ref).get()
            self.assertIsNotNone(commit)
Пример #6
0
  def test_conversion_to_svn_commit(self):
    my_repo = model_helpers.create_repo()
    my_repo.put()
    my_commit = model_helpers.create_commit()
    my_commit.put()
    commit_json = {
        'commit': 'deadbeef' * 5,
        'message': 'git-svn-id: svn://svn.chromium.org/chrome/trunk/src@200000 '
                   '0039d316-1c4b-4281-b951-d872f2087c98',
    }

    controller.write_commits_to_db( [commit_json], 'cool', 'cool_src')
    for ref in ('svn://svn.chromium.org/chrome',
                'svn://svn.chromium.org/chrome/trunk',
                'svn://svn.chromium.org/chrome/trunk/src'):
      commit = models.NumberingMap.get_key_by_id(
          200000,
          models.NumberingType.SVN,
          ref=ref).get()
      self.assertIsNotNone(commit)