From 369814b4a77adcc78b2549ad728e0d69175f08e8 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Wed, 10 Jul 2019 17:10:07 -0400 Subject: 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 Reviewed-by: David Pursehouse --- tests/test_git_command.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tests/test_git_command.py') diff --git a/tests/test_git_command.py b/tests/test_git_command.py index 928eb402..4d65d3ce 100644 --- a/tests/test_git_command.py +++ b/tests/test_git_command.py @@ -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) -- cgit v1.2.3-54-g00ecf