Commit 3db17cdc by Brian Beggs

Update Acceptence tests for data czar export key changes

parent 4fc15842
...@@ -123,9 +123,10 @@ class ExportAcceptanceTest(AcceptanceTestCase): ...@@ -123,9 +123,10 @@ class ExportAcceptanceTest(AcceptanceTestCase):
Uploads the package to s3://<exporter_output_bucket>/<output_prefix>edx-<year>-<month>-<day>.zip Uploads the package to s3://<exporter_output_bucket>/<output_prefix>edx-<year>-<month>-<day>.zip
""" """
config_file_path = os.path.join(self.temporary_dir, '{}_acceptance.yml'.format(org_id)) env_config_file_path = os.path.join(self.temporary_dir, '{}_env_acceptance.yml'.format(org_id))
org_config_file_path = os.path.join(self.temporary_dir, '{}_org_acceptance.yml'.format(org_id))
self.write_exporter_config(org_id, course_id, config_file_path) self.write_exporter_config(org_id, course_id, env_config_file_path, org_config_file_path)
src_url_tuple = urlparse.urlparse(self.test_src) src_url_tuple = urlparse.urlparse(self.test_src)
...@@ -136,16 +137,17 @@ class ExportAcceptanceTest(AcceptanceTestCase): ...@@ -136,16 +137,17 @@ class ExportAcceptanceTest(AcceptanceTestCase):
'--pipeline-bucket', src_url_tuple.netloc, '--pipeline-bucket', src_url_tuple.netloc,
'--external-prefix', src_url_tuple.path.lstrip('/'), '--external-prefix', src_url_tuple.path.lstrip('/'),
'--output-prefix', self.output_prefix, '--output-prefix', self.output_prefix,
config_file_path, env_config_file_path,
org_config_file_path,
'--env', self.ENVIRONMENT, '--env', self.ENVIRONMENT,
'--org', org_id, '--org', org_id,
'--task', 'StudentModuleTask' '--task', 'StudentModuleTask'
] ]
shell.run(command) shell.run(command)
def write_exporter_config(self, org_id, course_id, config_file_path): def write_exporter_config(self, org_id, course_id, env_config_file_path, org_config_file_path):
"""Write out the configuration file that the exporter expects to the filesystem.""" """Write out the configuration file that the exporter expects to the filesystem."""
config_text = textwrap.dedent("""\ env_config_text = textwrap.dedent("""\
options: {{}} options: {{}}
defaults: defaults:
...@@ -159,27 +161,33 @@ class ExportAcceptanceTest(AcceptanceTestCase): ...@@ -159,27 +161,33 @@ class ExportAcceptanceTest(AcceptanceTestCase):
name: {environment}-analytics name: {environment}-analytics
sql_host: {sql_host} sql_host: {sql_host}
external_files: {external_files} external_files: {external_files}
organizations:
{org_id}:
recipients:
- daemon@edx.org
courses:
- {course_id}
""") """)
config_text = config_text.format( env_config_text = env_config_text.format(
sql_user=self.import_db.credentials['username'], sql_user=self.import_db.credentials['username'],
sql_db=self.import_db.database_name, sql_db=self.import_db.database_name,
sql_password=self.import_db.credentials['password'], sql_password=self.import_db.credentials['password'],
environment=self.ENVIRONMENT, environment=self.ENVIRONMENT,
sql_host=self.import_db.credentials['host'], sql_host=self.import_db.credentials['host'],
external_files=self.external_files_dir, external_files=self.external_files_dir,
)
with open(env_config_file_path, 'w') as env_config_file:
env_config_file.write(env_config_text)
org_config_text = textwrap.dedent("""\
organizations:
{org_id}:
recipients:
- daemon@edx.org
courses:
- {course_id}
""")
org_config_text = org_config_text.format(
org_id=org_id, org_id=org_id,
course_id=course_id, course_id=course_id,
) )
with open(org_config_file_path, 'w') as org_config_file:
org_config_file.write(org_config_text)
with open(config_file_path, 'w') as config_file:
config_file.write(config_text)
def validate_exporter_output(self, org_id, exported_filename): def validate_exporter_output(self, org_id, exported_filename):
""" """
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment