How to use the kobo.hub.models.Arch.objects.create function in kobo

To help you get started, we’ve selected a few kobo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github release-engineering / kobo / tests / test_view_log.py View on Github external
def setUp(self):
        super(TestViewLog, self).setUp()

        self.cleanDataDirs()

        # These objects are required to exist but their attributes are irrelevant
        user = User.objects.create()
        arch = Arch.objects.create(name='testarch')
        channel = Channel.objects.create(name='testchannel')

        test_task = Task.objects.create(
            pk=TASK_ID, arch=arch, channel=channel, owner=user)

        # associate some compressed and decompressed logs with the task.
        # (the save and gzip_logs methods here are writing files to disk)
        test_task.logs['zipped_tiny.log'] = tiny_log_content()
        test_task.logs['zipped_small.log'] = small_log_content()
        test_task.logs['zipped_big.log'] = self.big_log_content
        test_task.logs.save()
        test_task.logs.gzip_logs()

        test_task.logs['small.log'] = small_log_content()
        test_task.logs['big.log'] = self.big_log_content
        test_task.logs['log.html'] = html_content()
github release-engineering / kobo / tests / test_xmlrpc_client.py View on Github external
def setUp(self):
        self._fixture_teardown()
        super(TestXmlRpcClient, self).setUp()

        user = User.objects.create(username='testuser', is_superuser=True)
        arch = Arch.objects.create(name='noarch', pretty_name='noarch')
        channel = Channel.objects.create(name='default')

        self._arch = arch
        self._channel = channel
        self._user = user
github release-engineering / kobo / tests / test_task_logs.py View on Github external
def setUp(self):
        self._fixture_teardown()
        super(TestTaskLogs, self).setUp()

        self.cleanDataDirs()

        # These objects are required to exist but their attributes are irrelevant
        user = User.objects.create()
        arch = Arch.objects.create(name='testarch')
        channel = Channel.objects.create(name='testchannel')

        test_task = Task.objects.create(
            pk=TASK_ID, arch=arch, channel=channel, owner=user)

        self.log_content = log_content = b'Line 1 \xe2\x98\xba\nLine 2 \xe2\x98\xba\nLine 3'

        test_task.logs['test_compressed.log'] = log_content
        test_task.logs.save()
        test_task.logs.gzip_logs()

        test_task.logs['test.log'] = log_content
        test_task.logs.save()
github release-engineering / kobo / tests / test_views.py View on Github external
def setUp(self):
        self._fixture_teardown()
        self.arch1 = Arch.objects.create(name='arch-1', pretty_name='arch-1')
        self.arch2 = Arch.objects.create(name='arch-2', pretty_name='arch-2')

        self.client = django.test.Client()
github release-engineering / kobo / tests / test_taskmanager.py View on Github external
def setUp(self):
        self._fixture_teardown()
        super(TestTaskManager, self).setUp()

        TaskContainer.register_plugin(DummyForegroundTask)
        TaskContainer.register_plugin(DummyForkTask)
        TaskContainer.register_plugin(DummyHeavyTask)
        TaskContainer.register_plugin(DummyFailTask)
        TaskContainer.register_plugin(DummyExceptionTask)

        user = User.objects.create(username='testuser')
        arch = Arch.objects.create(name='testarch')
        channel = Channel.objects.create(name='testchannel')

        w = Worker.objects.create(
            worker_key='mock-worker',
            name='mock-worker',
        )

        w.arches.add(arch)
        w.channels.add(channel)
        w.save()

        self._arch = arch
        self._channel = channel
        self._user = user
        self._worker = RpcServiceMock(w)
github release-engineering / kobo / tests / test_views.py View on Github external
def setUp(self):
        self._fixture_teardown()
        self.arch1 = Arch.objects.create(name='arch-1', pretty_name='arch-1')
        self.arch2 = Arch.objects.create(name='arch-2', pretty_name='arch-2')

        self.client = django.test.Client()
github release-engineering / kobo / tests / test_taskmanager.py View on Github external
def test_take_task_if_wrong_arch(self):
        arch = Arch.objects.create(name='arch_x86', pretty_name='Arch x86')

        t = Task.objects.create(
            worker=self._worker.worker,
            arch=arch,
            channel=self._channel,
            owner=self._user,
            method='DummyForkTask',
            state=TASK_STATES['FREE'],
        )

        self.assertEqual(t.state, TASK_STATES['FREE'])

        tm = TaskManager(conf={'worker': self._worker})
        task_info = t.export(False)

        with patch('kobo.worker.taskmanager.os', fork=Mock(return_value=9999)) as os_mock: