Example #1
0
    def test_media_registers_successfully(self):
        media_file = os.path.join(__tests_root__, 'res', 'bootanimation.zip')
        command = RegisterMediaCommand(self.config, 'Boot Anim', 'bootanimation', '1', media_file)

        command.run()

        self.config.api.upload_artifact.assert_called_with(
            media_file, Media.parse(self.config, 'Boot anim', 'bootanimation', '1', media_file))
Example #2
0
    def test_latest_non_existant_media_registers_successfully(self):
        self.config.api.get_highest_artifact = MagicMock(return_value=None)
        media_file = os.path.join(__tests_root__, 'res', 'bootanimation.zip')
        command = RegisterMediaCommand(
            self.config, 'Boot Anim', 'bootanimation', 'latest', media_file)

        command.run()

        self.config.api.upload_artifact.assert_called_with(
            media_file, Media.parse(self.config, 'Boot anim', 'bootanimation', '1', media_file))
Example #3
0
def register_media_splash(config, name, version, media):
    """
    Register splash screen artifacts.

    \b
      NAME of the splash screen.
      VERSION of the splash screen.
      MEDIA file to be uploaded.

    \b
    For example, register a splash screen:
      $ mason register media splash mason-test latest splash.png

    \b
    Full docs: https://docs.bymason.com/mason-cli/#mason-register-media-splash
    """

    from cli.internal.commands.register import RegisterMediaCommand
    command = RegisterMediaCommand(config, name, 'splash', version, media)
    command.run()
Example #4
0
def register_media_bootanimation(config, name, version, media):
    """
    Register boot animation artifacts.

    \b
      NAME of the boot animation.
      VERSION of the boot animation.
      MEDIA file to be uploaded.

    \b
    For example, register a boot animation:
      $ mason register media bootanimation anim-name latest bootanimation.zip

    \b
    Full docs: https://docs.bymason.com/mason-cli/#mason-register-media-bootanimation
    """

    from cli.internal.commands.register import RegisterMediaCommand
    command = RegisterMediaCommand(config, name, 'bootanimation', version,
                                   media)
    command.run()