mirror of
https://github.com/Dev-Wiki/git-repo.git
synced 2025-09-27 02:52:13 +08:00
move UserAgent to git_command for wider user
We can't import the main module, so move the UserAgent helper out of it and into the git_command module so it can be used in more places. Bug: https://crbug.com/gerrit/11144 Change-Id: I8093c8a20bd1dc7d612d0e2a85180341817c0d86 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/231057 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: David Pursehouse <dpursehouse@collab.net>
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import re
|
||||
import unittest
|
||||
|
||||
import git_command
|
||||
@@ -47,3 +48,15 @@ class GitCallUnitTest(unittest.TestCase):
|
||||
self.assertLess(ver, (9999, 9999, 9999))
|
||||
|
||||
self.assertNotEqual('', ver.full)
|
||||
|
||||
|
||||
class RepoUserAgentUnitTest(unittest.TestCase):
|
||||
"""Tests the RepoUserAgent function."""
|
||||
|
||||
def test_smoke(self):
|
||||
"""Make sure it returns something useful."""
|
||||
ua = git_command.RepoUserAgent()
|
||||
# We can't dive too deep because of OS/tool differences, but we can check
|
||||
# the general form.
|
||||
m = re.match(r'^git-repo/[^ ]+ ([^ ]+) git/[^ ]+ Python/[0-9.]+', ua)
|
||||
self.assertIsNotNone(m)
|
||||
|
Reference in New Issue
Block a user