Exemplo n.º 1
0
    def setUp(self):
        super().setUp()

        class Options:
            source = "."
            nodejs_version = nodejs._NODEJS_VERSION
            nodejs_package_manager = "npm"
            nodejs_yarn_version = ""
            source = "."

        self.options = Options()

        # always have a package.json stub under source
        open("package.json", "w").close()

        patcher = mock.patch("snapcraft.internal.common.run")
        self.run_mock = patcher.start()
        self.addCleanup(patcher.stop)

        patcher = mock.patch("snapcraft.internal.common.run_output")
        self.run_output_mock = patcher.start()
        self.addCleanup(patcher.stop)
        self.run_output_mock.return_value = '{"dependencies": []}'

        patcher = mock.patch("snapcraft.sources.Tar")
        self.tar_mock = patcher.start()
        self.addCleanup(patcher.stop)

        self.nodejs_url = nodejs.get_nodejs_release(
            nodejs._NODEJS_VERSION, self.project.deb_arch
        )

        self.useFixture(fixture_setup.CleanEnvironment())
Exemplo n.º 2
0
 def test_get_nodejs_release(self, deb_arch, engine, expected_url):
     assert nodejs.get_nodejs_release(engine, deb_arch) == expected_url
Exemplo n.º 3
0
 def test_get_nodejs_release(self):
     node_url = nodejs.get_nodejs_release(self.engine, self.deb_arch)
     self.assertThat(node_url, Equals(self.expected_url))