Exemple #1
0
 def test_install_unexisting_package(self):
     try:
         dukpy.install_jspackage('non_existing_suerly_missing_dunno', '1', self.tmpdir)
     except:
         pass
     else:
         assert False, 'Should have not found exception'
Exemple #2
0
 def test_install_unexisting_package(self):
     try:
         dukpy.install_jspackage('non_existing_suerly_missing_dunno', '1',
                                 self.tmpdir)
     except:
         pass
     else:
         assert False, 'Should have not found exception'
Exemple #3
0
 def test_install_missing_download_url(self):
     with mock.patch('dukpy.install._fetch_package_info',
                     new=lambda *args: {'versions': {'99.9.9': {}}}):
         try:
             dukpy.install_jspackage('react', '99.9.9', self.tmpdir)
         except Exception as e:
             assert 'Unable to detect a supported download url' in str(e), str(e)
             raise
Exemple #4
0
 def test_install_missing_download_url(self):
     with mock.patch('dukpy.install._fetch_package_info',
                     new=lambda *args: {'versions': {
                         '99.9.9': {}
                     }}):
         with self.assertRaises(dukpy_install.JSPackageInstallError) as err:
             dukpy.install_jspackage('react', '99.9.9', self.tmpdir)
             assert 'Unable to detect a supported download url' in str(
                 err.exception)
Exemple #5
0
    def test_install_react(self):
        dukpy.install_jspackage('react', '0.14.8', self.tmpdir)
        dukpy.install_jspackage('react-dom', '0.14.8', self.tmpdir)

        jsx = dukpy.jsx_compile(TEST_CODE)

        jsi = dukpy.JSInterpreter()
        jsi.loader.register_path(self.tmpdir)
        res = jsi.evaljs(jsx, data={'id': 1, 'name': "Alessandro"})
        assert res == '<div class="helloworld">Hello Alessandro</div>', res
Exemple #6
0
    def test_install_react(self):
        dukpy.install_jspackage('react', '0.14.8', self.tmpdir)
        dukpy.install_jspackage('react-dom', '0.14.8', self.tmpdir)

        jsx = dukpy.jsx_compile(TEST_CODE)

        jsi = dukpy.JSInterpreter()
        jsi.loader.register_path(self.tmpdir)
        res = jsi.evaljs(jsx, data={'id': 1, 'name': "Alessandro"})
        assert res == '<div class="helloworld">Hello Alessandro</div>', res
Exemple #7
0
 def test_install_missing_download_url(self):
     with mock.patch('dukpy.install._fetch_package_info',
                     new=lambda *args: {'versions': {
                         '99.9.9': {}
                     }}):
         try:
             dukpy.install_jspackage('react', '99.9.9', self.tmpdir)
         except Exception as e:
             assert 'Unable to detect a supported download url' in str(
                 e), str(e)
             raise
Exemple #8
0
 def test_install_unexisting_version(self):
     dukpy.install_jspackage('react', '9999', self.tmpdir)
Exemple #9
0
 def test_install_unexisting_version(self):
     with self.assertRaises(dukpy_install.JSPackageInstallError):
         dukpy.install_jspackage('react', '9999', self.tmpdir)
Exemple #10
0
 def test_install_unexisting_package(self):
     with self.assertRaises(Exception) as err:
         dukpy.install_jspackage('non_existing_suerly_missing_dunno', '1',
                                 self.tmpdir)
     assert 'Not Found' in str(err.exception)
Exemple #11
0
 def test_install_unexisting_version(self):
     dukpy.install_jspackage('react', '9999', self.tmpdir)