Skip to content

Commit

Permalink
Update test to match Snowfakery's updated continuation API
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Prescod committed Nov 26, 2020
1 parent 656d663 commit 8f6a419
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from cumulusci.tasks.bulkdata.generate_and_load_data_from_yaml import (
GenerateAndLoadDataFromYaml,
)
from snowfakery import data_generator_runtime
from snowfakery import data_generator_runtime, data_generator

sample_yaml = Path(__file__).parent / "snowfakery/gen_npsp_standard_objects.yml"
simple_yaml = Path(__file__).parent / "snowfakery/include_parent.yml"
Expand Down Expand Up @@ -217,7 +217,7 @@ def test_mismatched_options(self):
task()
assert "without num_records_tablename" in str(e.exception)

def generate_continuation_data(self):
def generate_continuation_data(self, fileobj):
g = data_generator_runtime.Globals()
o = data_generator_runtime.ObjectRow(
"Account", {"Name": "Johnston incorporated", "id": 5}
Expand All @@ -226,14 +226,13 @@ def generate_continuation_data(self):
for i in range(0, 5):
# burn through 5 imaginary accounts
g.id_manager.generate_id("Account")
return yaml.safe_dump(g)
data_generator.save_continuation_yaml(g, fileobj)

def test_with_continuation_file(self):
continuation_data = self.generate_continuation_data()
with temp_sqlite_database_url() as database_url:
with temporary_file_path("cont.yml") as continuation_file_path:
with open(continuation_file_path, "w") as continuation_file:
continuation_file.write(continuation_data)
self.generate_continuation_data(continuation_file)

task = _make_task(
GenerateDataFromYaml,
Expand Down

0 comments on commit 8f6a419

Please sign in to comment.