diff options
| author | Mike Frysinger <vapier@google.com> | 2019-07-10 17:10:07 -0400 |
|---|---|---|
| committer | Mike Frysinger <vapier@google.com> | 2019-10-01 05:39:27 +0000 |
| commit | 369814b4a77adcc78b2549ad728e0d69175f08e8 (patch) | |
| tree | eccd05989cd69c424dce146b2ea76d0a7069b423 /tests/test_git_command.py | |
| parent | e37aa5f331aa39776d5db1a1f816b66496f60e0c (diff) | |
| download | git-repo-369814b4a77adcc78b2549ad728e0d69175f08e8.tar.gz | |
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>
Diffstat (limited to 'tests/test_git_command.py')
| -rw-r--r-- | tests/test_git_command.py | 13 |
1 files changed, 13 insertions, 0 deletions
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 @@ | |||
| 18 | 18 | ||
| 19 | from __future__ import print_function | 19 | from __future__ import print_function |
| 20 | 20 | ||
| 21 | import re | ||
| 21 | import unittest | 22 | import unittest |
| 22 | 23 | ||
| 23 | import git_command | 24 | import git_command |
| @@ -47,3 +48,15 @@ class GitCallUnitTest(unittest.TestCase): | |||
| 47 | self.assertLess(ver, (9999, 9999, 9999)) | 48 | self.assertLess(ver, (9999, 9999, 9999)) |
| 48 | 49 | ||
| 49 | self.assertNotEqual('', ver.full) | 50 | self.assertNotEqual('', ver.full) |
| 51 | |||
| 52 | |||
| 53 | class RepoUserAgentUnitTest(unittest.TestCase): | ||
| 54 | """Tests the RepoUserAgent function.""" | ||
| 55 | |||
| 56 | def test_smoke(self): | ||
| 57 | """Make sure it returns something useful.""" | ||
| 58 | ua = git_command.RepoUserAgent() | ||
| 59 | # We can't dive too deep because of OS/tool differences, but we can check | ||
| 60 | # the general form. | ||
| 61 | m = re.match(r'^git-repo/[^ ]+ ([^ ]+) git/[^ ]+ Python/[0-9.]+', ua) | ||
| 62 | self.assertIsNotNone(m) | ||
