Creating custom node aliases inside a simpletest I am attempting to write simpletests to replicate the steps to reproduce on this d.o issue.

I need to create a test node with a custom alias, as if I had unchecked the "Generate automatic URL alias" checkbox and supplied my own value. 

Currently, attempting to insert it with 

$edit = array(
  'title' =&gt; $this-&gt;randomName(),
  'path' =&gt; array(
    'source' =&gt; 'node/1',
    'alias' =&gt; 'qwerty',
  ),
);


fails, and generates errors, as does

 $edit = array(
    'title' =&gt; 'asdf',
    'path[alias]' =&gt; 'qwerty',
  );


So, I tried:

$path = array('source' =&gt; 'node/1', 'alias' =&gt; 'qwerty');
path_save($path);


The above successfully creates an alias, but when I inspect $node-&gt;path[
alias'] it shows me something other than qwerty. 

drupal_lookup_path('alias', "node/".$node-&gt;nid) also returns only the Pathauto-generated alias, and not any alias that was created manually, even in the node edit form.

Additionally, if I create a new alias from the same source, my original alias is not replaced, as it would be if I had manually entered a new alias into the field on the node edit form. 

As I am attempting to exactly duplicate the steps to reproduce in the linked d.o issue, it matters how the alias gets created. Is there any way to more exactly replicate the manual creation of an alias on the node edit form, inside a test?
It turns out that 

$edit = array(
  'title' =&gt; 'asdf',
  'path[alias]' =&gt; 'qwerty',
);


was correct, but that I needed to add the permission 'create url aliases' to the drupalCreateUser array.