def test_extract(self): github_plugin = GithubPlugin('org/test-pgo-plugin#2d54eddde33061be9b329efae0cfb9bd58842655') src = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'resources', 'test-pgo-plugin-2d54eddde33061be9b329efae0cfb9bd58842655.zip') zip_dest = github_plugin.get_local_destination() shutil.copyfile(src, zip_dest) github_plugin.extract() plugin_folder = github_plugin.get_plugin_folder() os.path.isdir(plugin_folder) sub_folder = os.path.join(plugin_folder, 'test-pgo-plugin') os.path.isdir(sub_folder) sha_file = os.path.join(github_plugin.get_plugin_folder(), '.sha') os.path.isfile(sha_file) with open(sha_file) as file: content = file.read().strip() self.assertEqual(content, '2d54eddde33061be9b329efae0cfb9bd58842655') shutil.rmtree(plugin_folder)
def test_get_local_destination(self): github_plugin = GithubPlugin('org/repo#sha') path = github_plugin.get_local_destination() expected = os.path.join(PLUGIN_PATH, 'org_repo_sha.zip') self.assertEqual(path, expected)