feat(data): remove writing of old config

### Description of Changes
  Phase three of config data model change.
This commit is contained in:
Charlton Austin 2017-03-28 14:35:47 -04:00
parent ca99535774
commit 40906afdd8
4 changed files with 2 additions and 27 deletions

View file

@ -9,7 +9,6 @@ from data.database import (BuildTriggerService, RepositoryBuildTrigger, Reposito
RepositoryBuild, BUILD_PHASE, db_for_update, db_random_func)
from data.model import (InvalidBuildTriggerException, InvalidRepositoryBuildException,
db_transaction, user as user_model)
from data.model.helpers.build_helper import _get_config_expand
PRESUMED_DEAD_BUILD_AGE = timedelta(days=15)
PHASES_NOT_ALLOWED_TO_CANCEL_FROM = (BUILD_PHASE.PUSHING, BUILD_PHASE.COMPLETE,
@ -19,7 +18,7 @@ ARCHIVABLE_BUILD_PHASES = [BUILD_PHASE.COMPLETE, BUILD_PHASE.ERROR, BUILD_PHASE.
def update_build_trigger(trigger, config, auth_token=None, write_token=None):
trigger.config = json.dumps(_get_config_expand(config or {}))
trigger.config = json.dumps(config or {})
if auth_token is not None:
trigger.auth_token = auth_token
@ -30,13 +29,12 @@ def update_build_trigger(trigger, config, auth_token=None, write_token=None):
def create_build_trigger(repo, service_name, auth_token, user, pull_robot=None, config=None):
config = config or {}
service = BuildTriggerService.get(name=service_name)
trigger = RepositoryBuildTrigger.create(repository=repo, service=service,
auth_token=auth_token,
connected_user=user,
pull_robot=pull_robot,
config=json.dumps(_get_config_expand(config)))
config=json.dumps(config or {}))
return trigger

View file

@ -1,9 +0,0 @@
def _get_config_expand(config):
""" Get config with both context and dockerfile_path written to it """
if not config:
return {}
if 'context' in config:
config['subdir'] = config['context']
return config

View file

@ -1,14 +0,0 @@
import pytest
from data.model.helpers.build_helper import _get_config_expand
@pytest.mark.parametrize('org_config,expected', [
(None, {}),
({}, {}),
({'some other key': 'some other value'}, {'some other key': 'some other value'}),
({'context': 'some/context', 'dockerfile_path': 'some/context/with/Dockerfile'},
{'context': 'some/context', 'dockerfile_path': 'some/context/with/Dockerfile', 'subdir': 'some/context'}),
])
def test_super_user_build_endpoints(org_config, expected):
assert _get_config_expand(org_config) == expected