def test_get_plugin(mock_remove, mock_unzip, mock_download_file):
	mock_download_file.return_value = True
	mock_unzip.return_value = 'wp/wp-content/plugins/plugin'
	res = wpa.get_plugin('plugin', '1.2.3', 'wp')
	mock_download_file.assert_called_with(
					'https://downloads.wordpress.org/plugin/plugin.1.2.3.zip',
					wpa.TEMP_DIR,
					'plugin.1.2.3.zip')
	mock_unzip.assert_called_with(os.path.join(wpa.TEMP_DIR, 'plugin.1.2.3.zip'), 'wp/wp-content/plugins')
	mock_remove.assert_called_with(os.path.join(wpa.TEMP_DIR, 'plugin.1.2.3.zip'))
	assert_equal(res, 'wp/wp-content/plugins/plugin')
Esempio n. 2
0
def test_get_plugin(mock_remove, mock_unzip, mock_download_file):
	mock_download_file.return_value = True
	mock_unzip.return_value = 'wp/wp-content/plugins/plugin'
	res = wpa.get_plugin('plugin', '1.2.3', 'wp')
	mock_download_file.assert_called_with(
					'https://downloads.wordpress.org/plugin/plugin.1.2.3.zip',
					wpa.TEMP_DIR,
					'plugin.1.2.3.zip')
	mock_unzip.assert_called_with(os.path.join(wpa.TEMP_DIR, 'plugin.1.2.3.zip'), 'wp/wp-content/plugins')
	mock_remove.assert_called_with(os.path.join(wpa.TEMP_DIR, 'plugin.1.2.3.zip'))
	assert_equal(res, 'wp/wp-content/plugins/plugin')
Esempio n. 3
0
def test_get_plugin(mock_join, mock_get_zipped_asset):
	mock_get_zipped_asset.return_value = 'wp/wp-content/plugins/plugin1'
	mock_join.return_value = 'wp/wp-content/plugins'
	res = wpa.get_plugin('plugin1', '1.2.3', 'wp')
	mock_join.assert_called_with('wp', 'wp-content', 'plugins')
	assert_equal(res, 'wp/wp-content/plugins/plugin1')