Esempio n. 1
0
    def test_to_manifest(self):
        for manifest, credentials in TEST_ADMINAPP_MANIFESTS + TEST_UIAPP_MANIFESTS:
            app = MachineApp.from_manifest(manifest, credentials, save=False)
            parsed_m = simplejson.loads(manifest)
            reparsed_m = simplejson.loads(app.to_manifest())

            # The reparsed manifest should contain AT LEAST as much info as the original
            for k, v in parsed_m.iteritems():
                self.assertEqual(v, reparsed_m.get(k, None))
Esempio n. 2
0
    def test_to_manifest(self):
        for manifest, credentials in TEST_ADMINAPP_MANIFESTS + TEST_UIAPP_MANIFESTS:
            app = MachineApp.from_manifest(manifest, credentials, save=False)
            parsed_m = simplejson.loads(manifest)
            reparsed_m = simplejson.loads(app.to_manifest())

            # The reparsed manifest should contain AT LEAST as much info as the original
            for k, v in parsed_m.iteritems():
                self.assertEqual(v, reparsed_m.get(k, None))
Esempio n. 3
0
    def test_from_manifest(self):
        all_manifests = TEST_ADMINAPP_MANIFESTS + TEST_UIAPP_MANIFESTS

        # test that save=False works
        for manifest, credentials in all_manifests:
            num_phas = MachineApp.objects.count()
            app = MachineApp.from_manifest(manifest, credentials, save=False)
            self.assertEqual(num_phas, MachineApp.objects.count())
                        
        # Should work with admin apps
        for manifest, credentials in TEST_ADMINAPP_MANIFESTS:
            parsed_m, parsed_c, app = self.buildAppFromManifest(MachineApp, manifest, credentials)
            self.assertValidAdminAppManifest(parsed_m, parsed_c, app, ui=False)

        # Or with UI apps
        for manifest, credentials in TEST_UIAPP_MANIFESTS:
            parsed_m, parsed_c, app = self.buildAppFromManifest(MachineApp, manifest, credentials)
            self.assertValidAdminAppManifest(parsed_m, parsed_c, app, ui=True)
Esempio n. 4
0
    def test_from_manifest(self):
        all_manifests = TEST_ADMINAPP_MANIFESTS + TEST_UIAPP_MANIFESTS

        # test that save=False works
        for manifest, credentials in all_manifests:
            num_phas = MachineApp.objects.count()
            app = MachineApp.from_manifest(manifest, credentials, save=False)
            self.assertEqual(num_phas, MachineApp.objects.count())

        # Should work with admin apps
        for manifest, credentials in TEST_ADMINAPP_MANIFESTS:
            parsed_m, parsed_c, app = self.buildAppFromManifest(
                MachineApp, manifest, credentials)
            self.assertValidAdminAppManifest(parsed_m, parsed_c, app, ui=False)

        # Or with UI apps
        for manifest, credentials in TEST_UIAPP_MANIFESTS:
            parsed_m, parsed_c, app = self.buildAppFromManifest(
                MachineApp, manifest, credentials)
            self.assertValidAdminAppManifest(parsed_m, parsed_c, app, ui=True)