| Index: sitescripts/extensions/test/test_createNightlies.py.orig | 
| =================================================================== | 
| new file mode 100644 | 
| --- /dev/null | 
| +++ b/sitescripts/extensions/test/test_createNightlies.py.orig | 
| @@ -0,0 +1,74 @@ | 
| +# This file is part of the Adblock Plus web scripts, | 
| +# Copyright (C) 2006-2016 Eyeo GmbH | 
| +# | 
| +# Adblock Plus is free software: you can redistribute it and/or modify | 
| +# it under the terms of the GNU General Public License version 3 as | 
| +# published by the Free Software Foundation. | 
| +# | 
| +# Adblock Plus is distributed in the hope that it will be useful, | 
| +# but WITHOUT ANY WARRANTY; without even the implied warranty of | 
| +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 
| +# GNU General Public License for more details. | 
| +# | 
| +# You should have received a copy of the GNU General Public License | 
| +# along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 
| + | 
| +"""Tests for create nightlies script.""" | 
| +import os | 
| +from subprocess import CalledProcessError | 
| + | 
| +import pytest | 
| + | 
| +from sitescripts.extensions.bin import createNightlies | 
| +from sitescripts.utils import get_config | 
| + | 
| +# @pytest.fixture(scope='session') | 
| +# def expected_changes(): | 
| +# return {} | 
| +@pytest.fixture(scope='session') | 
| +def config(hg_dir): | 
| + """Set and return config obj for NightlyBuild""" | 
| + config = get_config() | 
| + config.type = 'safari' | 
| + config.revision = 'safari' | 
| + config.repositoryName = 'adblockplusnightly' | 
| + config.repository = hg_dir.join('adblockplusnightly').strpath | 
| + return config | 
| + | 
| + | 
| +@pytest.fixture(scope='session') | 
| +def nightlybuild(config): | 
| + return createNightlies.NightlyBuild(config) | 
| + | 
| + | 
| +@pytest.fixture(scope='session') | 
| +def current_revision(nightlydir): | 
| + return '1291590ddd0f' | 
| + | 
| + | 
| +def test_nightly_object_bookmark(nightlybuild): | 
| + assert nightlybuild.config.revision == 'safari' | 
| + | 
| + | 
| +def test_current_revision(current_revision, nightlybuild): | 
| + assert nightlybuild.revision == current_revision | 
| + | 
| + | 
| +def test_copy_repository(nightlybuild, nightlydir): | 
| + nightlybuild.copyRepository() | 
| + assert os.listdir(nightlybuild.tempdir) == os.listdir(nightlydir.strpath) | 
| + | 
| + | 
| +def test_create_changes(nightlybuild, nightlydir): | 
| + for change in nightlybuild.getChanges(): | 
| + for key, value in change.items()1 | 
| + assert expected_changes[key] == value | 
| + | 
| + | 
| +def test_missing_bookmark(config): | 
| + config.revision = 'foo' | 
| + config.type = 'type' | 
| + try: | 
| + createNightlies.NightlyBuild(config) | 
| + except CalledProcessError as e: | 
| + assert e.returncode == 255 |