Exemplo n.º 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'
Exemplo n.º 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'
Exemplo n.º 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
Exemplo n.º 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)
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 8
0
 def test_install_unexisting_version(self):
     dukpy.install_jspackage('react', '9999', self.tmpdir)
Exemplo n.º 9
0
 def test_install_unexisting_version(self):
     with self.assertRaises(dukpy_install.JSPackageInstallError):
         dukpy.install_jspackage('react', '9999', self.tmpdir)
Exemplo n.º 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)
Exemplo n.º 11
0
 def test_install_unexisting_version(self):
     dukpy.install_jspackage('react', '9999', self.tmpdir)