diff options
author | Georgy Redkozubov <georgy.redkozubov@linaro.org> | 2012-12-05 17:47:59 +0400 |
---|---|---|
committer | Georgy Redkozubov <georgy.redkozubov@linaro.org> | 2012-12-05 17:47:59 +0400 |
commit | f4983fe1250336e2a68bc51592dfc545a3c22ee5 (patch) | |
tree | dd4c327fa57dc82b5cefb8f96903578f0f4e11fe /tests | |
parent | b33a811803cc801ed182e40d115a3f452dd88939 (diff) |
Added reshuffling of android artifacts
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_publish_to_snapshots.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/test_publish_to_snapshots.py b/tests/test_publish_to_snapshots.py index 6a3f3e0..1cecff0 100644 --- a/tests/test_publish_to_snapshots.py +++ b/tests/test_publish_to_snapshots.py @@ -10,6 +10,7 @@ from scripts.publish_to_snapshots import ( PublisherArgumentException, SnapshotsPublisher, setup_parser, + product_dir_path, ) @@ -696,3 +697,32 @@ class TestSnapshotsPublisher(TestCase): self.assertEqual(os.path.basename(artifact), open(moved_artifact).read()) self.assertIn("Moved the files from", stdout.read()) + + def test_flatten_android_artifacts(self): + source_dir = tempfile.mkdtemp() + full_product_path = os.path.join(source_dir, product_dir_path) + full_board_path = os.path.join(full_product_path, 'board') + full_howto_path = os.path.join(full_board_path, 'howto') + os.makedirs(full_howto_path) + + content = "file_content" + file_name = os.path.join(full_board_path, "artifact.txt") + file = open(file_name, "w") + file.write(content) + file.close() + + howto_content = "howto_file_content" + howto_file_name = os.path.join(full_howto_path, "HOWTO_install.txt") + file = open(howto_file_name, "w") + file.write(howto_content) + file.close() + + publisher = SnapshotsPublisher() + publisher.reshuffle_android_artifacts(source_dir) + resulting_file = os.path.join(source_dir, + os.path.basename(file_name)) + resulting_howto_file = os.path.join(source_dir, 'howto', + os.path.basename(howto_file_name)) + self.assertEqual(content, open(resulting_file).read()) + self.assertEqual(howto_content, open(resulting_howto_file).read()) + shutil.rmtree(source_dir) |