| Index: unittests/package_test.py
|
| diff --git a/unittests/package_test.py b/unittests/package_test.py
|
| index bc1d26c8daea8864741806d139b1c7b7ca5a9a07..5b070ecc178b800925227dd92aac82e1aa6571f7 100755
|
| --- a/unittests/package_test.py
|
| +++ b/unittests/package_test.py
|
| @@ -12,9 +12,8 @@
|
| import repo_test_util
|
|
|
| import mock
|
| -
|
| -from recipe_engine import fetch
|
| from recipe_engine import package
|
| +
|
|
|
| TEST_AUTHOR = 'foo@example.com'
|
|
|
| @@ -382,59 +381,6 @@
|
| super(TestPackageSpec, self).setUp()
|
|
|
| self.proto_text = '\n'.join([
|
| - '{',
|
| - ' "api_version": 2,',
|
| - ' "deps": {',
|
| - ' "bar": {',
|
| - ' "branch": "superbar",',
|
| - ' "revision": "deadd00d",',
|
| - ' "url": "https://repo.com/bar.git"',
|
| - ' },',
|
| - ' "foo": {',
|
| - ' "branch": "master",',
|
| - ' "revision": "cafebeef",',
|
| - ' "url": "https://repo.com/foo.git"',
|
| - ' }',
|
| - ' },',
|
| - ' "project_id": "super_main_package",',
|
| - ' "recipes_path": "path/to/recipes"',
|
| - '}',
|
| - ])
|
| - self.proto_file = MockProtoFile('repo/root/infra/config/recipes.cfg',
|
| - self.proto_text)
|
| - self.context = package.PackageContext.from_proto_file(
|
| - 'repo/root', self.proto_file, allow_fetch=False)
|
| -
|
| - def test_dump_load_inverses(self):
|
| - # Doubles as a test for equality reflexivity.
|
| - package_spec = package.PackageSpec.load_proto(self.proto_file)
|
| - self.assertEqual(self.proto_file.to_raw(package_spec.dump()),
|
| - self.proto_text)
|
| - self.assertEqual(package.PackageSpec.load_proto(self.proto_file),
|
| - package_spec)
|
| -
|
| - def test_dump_round_trips(self):
|
| - proto_text = """
|
| -{"api_version": 1}
|
| -""".lstrip()
|
| - proto_file = MockProtoFile('repo/root/infra/config/recipes.cfg', proto_text)
|
| - package_spec = package.PackageSpec.load_proto(proto_file)
|
| - self.assertEqual(proto_file.to_raw(package_spec.dump()),
|
| - '{\n "api_version": 1\n}')
|
| -
|
| - def test_no_version(self):
|
| - proto_text = """{
|
| - "project_id": "foo",
|
| - "recipes_path": "path/to/recipes"
|
| -}
|
| -"""
|
| - proto_file = MockProtoFile('repo/root/infra/config/recipes.cfg', proto_text)
|
| -
|
| - with self.assertRaises(AssertionError):
|
| - package.PackageSpec.load_proto(proto_file)
|
| -
|
| - def test_old_deps(self):
|
| - proto_text = '\n'.join([
|
| '{',
|
| ' "api_version": 1,',
|
| ' "deps": [',
|
| @@ -455,19 +401,38 @@
|
| ' "recipes_path": "path/to/recipes"',
|
| '}',
|
| ])
|
| + self.proto_file = MockProtoFile('repo/root/infra/config/recipes.cfg',
|
| + self.proto_text)
|
| + self.context = package.PackageContext.from_proto_file(
|
| + 'repo/root', self.proto_file, allow_fetch=False)
|
| +
|
| + def test_dump_load_inverses(self):
|
| + # Doubles as a test for equality reflexivity.
|
| + package_spec = package.PackageSpec.load_proto(self.proto_file)
|
| + self.assertEqual(self.proto_file.to_raw(package_spec.dump()),
|
| + self.proto_text)
|
| + self.assertEqual(package.PackageSpec.load_proto(self.proto_file),
|
| + package_spec)
|
| +
|
| + def test_dump_round_trips(self):
|
| + proto_text = """
|
| +{"api_version": 1}
|
| +""".lstrip()
|
| proto_file = MockProtoFile('repo/root/infra/config/recipes.cfg', proto_text)
|
| -
|
| - spec = package.PackageSpec.load_proto(proto_file)
|
| - self.assertEqual(spec.deps['foo'], package.GitRepoSpec(
|
| - 'foo',
|
| - 'https://repo.com/foo.git',
|
| - 'master',
|
| - 'cafebeef',
|
| - '',
|
| - fetch.GitBackend()
|
| - ))
|
| - self.assertEqual(proto_file.to_raw(spec.dump()), proto_text)
|
| -
|
| + package_spec = package.PackageSpec.load_proto(proto_file)
|
| + self.assertEqual(proto_file.to_raw(package_spec.dump()),
|
| + '{\n "api_version": 1\n}')
|
| +
|
| + def test_no_version(self):
|
| + proto_text = """{
|
| + "project_id": "foo",
|
| + "recipes_path": "path/to/recipes"
|
| +}
|
| +"""
|
| + proto_file = MockProtoFile('repo/root/infra/config/recipes.cfg', proto_text)
|
| +
|
| + with self.assertRaises(AssertionError):
|
| + package.PackageSpec.load_proto(proto_file)
|
|
|
| def test_unsupported_version(self):
|
| proto_text = """{
|
|
|