Example #1
0
def on_action(action_list, action):
    action = Action(
        event=action.get_event_display(),
        **action.get_attributes()
    )
    action_list.append(action)
    return action_list
Example #2
0
    def test_action(self):
        root = Action(**self.action_attr)

        self.assertXmlNode(root, tag='action', text=None)

        for key, val in list(self.action_attr.items()):
            self.assertXmlHasAttribute(root, key, expected_value=val)
Example #3
0
    def test_actions(self):
        root = Actions([Action(**self.action_attr)])

        self.assertXmlNode(root, tag='actions', text=None)
        self.assertXpathsExist(root, ('./action',))

        for key, val in self.action_attr.items():
            self.assertXpathsExist(root, ('./action[@{0}="{1}"]'.format(key, val),))
Example #4
0
    def test_valid_response_positive(self):
        updatecheck = Updatecheck_positive(
            urls=[
                'http://cache.pack.google.com/edgedl/chrome/install/782.112/'
            ],
            manifest=Manifest(version='13.0.782.112',
                              packages=Packages([
                                  Package(
                                      name='chrome_installer.exe',
                                      required='true',
                                      size='23963192',
                                      hash='VXriGUVI0TNqfLlU02vBel4Q3Zo=',
                                  )
                              ]),
                              actions=Actions([
                                  Action(event='install',
                                         arguments='--do-not-launch-chrome',
                                         run='chrome_installer.exe'),
                                  Action(event='postinstall',
                                         version='13.0.782.112',
                                         onsuccess='exitsilentlyonlaunchcmd'),
                              ])))
        app = App(
            '{D0AB2EBC-931B-4013-9FEB-C9C4C2225C8C}',
            status='ok',
            updatecheck=updatecheck,
            ping=True,
        )

        response = Response(
            server='prod',
            protocol='3.0',
            date=datetime(2014, 1, 1, hour=15, minute=41,
                          second=48),  # 56508 sec
            apps_list=[
                App('{430FD4D0-B729-4F61-AA34-91526481799D}',
                    status='ok',
                    ping=True,
                    updatecheck=Updatecheck_negative()),
                app,
            ])

        self.assertXmlValidXSchema(response, filename=RESPONSE_XSD_FILE)
        self.assertXmlEquivalentOutputs(
            etree.tostring(response), fixtures.response_update_check_positive)
Example #5
0
    def test_manifest(self):
        root = Manifest(packages=Packages([Package(**self.package_attr)] * 5),
                        actions=Actions([Action(**self.action_attr)] * 5),
                        **self.manifest_attr)

        self.assertXmlNode(root, tag='manifest', text=None)
        self.assertXmlHasAttribute(root, 'version', expected_value=self.manifest_attr['version'])
        self.assertXpathsExist(root, ('./packages',))
        self.assertXpathsExist(root, ('./actions',))

        for key, val in self.action_attr.items():
            self.assertXpathsExist(root, ('./actions/action[@{0}="{1}"]'.format(key, val),))

        for key, val in self.package_attr.items():
            self.assertXpathsExist(root, ('./packages/package[@{0}="{1}"]'.format(key, val),))
Example #6
0
    def test_updatecheck_positive(self):
        root = Updatecheck_positive(
            urls=[self.url] * 5,
            manifest=Manifest(packages=Packages([Package(**self.package_attr)] * 5),
                              actions=Actions([Action(**self.action_attr)] * 5),
                              **self.manifest_attr)
        )

        self.assertXmlNode(root, tag='updatecheck', text=None)
        self.assertXmlHasAttribute(root, 'status', expected_value='ok')
        self.assertXpathsExist(root, ('./urls',))
        self.assertXpathsExist(root, ('./manifest',))

        for key, val in self.action_attr.items():
            self.assertXpathsExist(root, ('./manifest/actions/action[@{0}="{1}"]'.format(key, val),))

        for key, val in self.package_attr.items():
            self.assertXpathsExist(root, ('./manifest/packages/package[@{0}="{1}"]'.format(key, val),))
Example #7
0
def on_action(action_list, action):
    action = Action(event=action.get_event_display(),
                    **action.get_attributes())
    action_list.append(action)
    return action_list