Creating a test user

I need a test user. Simple, I’ll use eng-bot. This will certainly not consume the next two hours. Oh, the default configuration makes the test user purchase an offering with a health assessment. My feature specifically excludes users with health assessments. I’ll add another purchase. Nevermind—that creates a new order, and the users of this feature are only allowed to have one order. I guess I’ll modify the code for eng-bot. I clone the repo. Neat, I can run it locally. Let’s hack something together. I’ll add a command-line argument to specify an offering ID for the test user. Hm. That almost worked, but the system cancelled the purchase and re-purchased a different offering. I’ll check Slack. It’s because we’ve prescribed a sequence to the user several steps back, and if the sequence is not on the offering we selected, that purchase gets cancelled and replaced by a purchase for the correct offering. Right. New plan. Before we prescribe the sequence, take the offering ID, retrieve the offering, find the prescribable sequence on that offering, select that as the sequence. Damn it—the graph schema for prescribers doesn’t have a way to retrieve a single offering, but I can retrieve a list of all offerings. I don’t want to make a schema change for this. I pull all offerings and loop through to find the one that matches. It’s ugly, but now I can find the prescribable sequence. Got it. Testing… it works! Wait, this user is on weight maintenance. My feature specifically excludes users on weight maintenance. Where the hell is weight maintenance defined? Oh, medical record. Medical record gets this information from… the sequence? The sequence tags. Right. Back to my changes. Filter sequences which are tagged maintenance. Now that my code selects a specific sequence, I should be able to remove the earlier code which purchases the offering from the command line argument. Fuck! I actually needed that, now it’s choosing whichever offering fits that prescribed sequence… and it chose an offering with health assessments again. I’ll add the changes back. Now my changes are figuring out the correct prescribed sequence, then having the test user purchase the correct offering at a later step, so that they only have one order created and are not on weight maintenance. Eureka! I finally have a test user. Why is my feature still not working? The order’s sole consignment is being fulfilled via Netsuite. My feature specifically excludes users with consignments fulfilled via Netsuite. I’m leaving for lunch.