'Literals are raw bytes. Testing that raw bytes are processed right.'

def testCopyHuntHandlesLiteralExpressionCorrectly(self):

    literal_match = rdf_file_finder.FileFinderContentsLiteralMatchCondition(literal='foo\r\xc8bar')
    implementation.GRRHunt.StartHunt(hunt_name=standard.GenericHunt.__name__, description='model    hunt', flow_runner_args=rdf_flows.FlowRunnerArgs(flow_name=file_finder.FileFinder.__name__), flow_args=rdf_file_finder.FileFinderArgs(conditions=[rdf_file_finder.FileFinderCondition(condition_type='CONTENTS_LITERAL_MATCH', contents_literal_match=literal_match)], paths=['/tmp/evil.txt']), token=self.token)
    self.Open('/#main=ManageHunts')
    self.Click("css=tr:contains('model    hunt')")
    self.Click('css=button[name=CopyHunt]:not([disabled])')
    self.WaitUntil(self.IsTextPresent, 'What    to    run?')
    self.WaitUntilEqual('foo\\x0d\\xc8bar', self.GetValue, "css=grr-new-hunt-wizard-form    label:contains('Literal')    ~    *    input:text")
    self.Click('css=grr-new-hunt-wizard-form    button.Next')
    self.WaitUntil(self.IsTextPresent, 'Output    Processing')
    self.Click('css=grr-new-hunt-wizard-form    button.Next')
    self.WaitUntil(self.IsTextPresent, 'Where    to    run?')
    self.Click('css=grr-new-hunt-wizard-form    button.Next')
    self.WaitUntil(self.IsTextPresent, 'Review')
    self.WaitUntil(self.IsTextPresent, file_finder.FileFinder.__name__)
    self.WaitUntil(self.IsTextPresent, 'foo\\x0d\\xc8bar')
    self.Click('css=grr-new-hunt-wizard-form    button.Next')
    self.WaitUntil(self.IsTextPresent, 'Created    Hunt')
    self.Click('css=button.Next')
    hunts_root = aff4.FACTORY.Open('aff4:/hunts', token=self.token)
    hunts_list = sorted(list(hunts_root.ListChildren()), key=(lambda x: x.age))
    self.assertEqual(len(hunts_list), 2)
    last_hunt = aff4.FACTORY.Open(hunts_list[(-1)], token=self.token)
    self.assertEqual(last_hunt.args.flow_runner_args.flow_name, file_finder.FileFinder.__name__)
    self.assertEqual(last_hunt.args.flow_args.conditions[0].contents_literal_match.literal, 'foo\r\xc8bar')
