示例#1
0
    def test_get_tar__invalid_sha256(self):
        """Validates getting a test tar file with an invalid sha256 hash_code.
        """
        repo = tar.TarImageRepository(self.tm_env)

        with self.assertRaises(Exception):
            repo.get('file://{0}/sleep.tar?sha256={1}'.format(
                os.path.abspath(os.path.dirname(__file__)),
                'asdfadsfasdfasdf'))
示例#2
0
    def test_get_tar__invalid_sha256(self):
        """Validates getting a test tar file with an invalid sha256 hash_code.
        """
        with io.open(os.path.join(self.tmp_dir, 'sleep.tar'), 'wb') as f:
            f.write(_test_data('sleep.tar'))

        repo = tar.TarImageRepository(self.tm_env)

        with self.assertRaises(Exception):
            repo.get('file://{0}/sleep.tar?sha256={1}'.format(
                self.tmp_dir, 'this_is_an_invalid_sha256'))
示例#3
0
    def test_get_tar_sha256_unpack(self):
        """Validates getting a test tar file with a sha256 hash_code."""

        repo = tar.TarImageRepository(self.tm_env)
        img = repo.get('file://{0}/sleep.tar?sha256={1}'.format(
            os.path.abspath(os.path.dirname(__file__)),
            '5a0f99c73b03f7f17a9e03b20816c2931784d5e1fc574eb2d0dece57'
            'f509e520'))

        self.assertIsNotNone(img)
        img.unpack(self.container_dir, self.root, self.app)
示例#4
0
    def test_get_tar_sha256_unpack(self):
        """Validates getting a test tar file with a sha256 hash_code."""
        with io.open(os.path.join(self.tmp_dir, 'sleep.tar'), 'wb') as f:
            f.write(_test_data('sleep.tar'))

        repo = tar.TarImageRepository(self.tm_env)
        img = repo.get('file://{0}/sleep.tar?sha256={1}'.format(
            self.tmp_dir,
            '5a0f99c73b03f7f17a9e03b20816c2931784d5e1fc574eb2d0dece57'
            'f509e520'))

        self.assertIsNotNone(img)
        img.unpack(self.container_dir, self.root, self.app, {}, {})