def setUp(self): self.build = first(Squad().builds(count=1))
def setUp(self): self.testrun = first(Squad().testruns(count=1))
def setUp(self): self.project = first(Squad().projects(slug='my_project')) self.build = first(Squad().builds(version='my_build')) self.build2 = first(Squad().builds(version='my_build2'))
def get(self, _id): count = 1 result = self.__fetch__(self.__class__, {'id': _id}, count) return first(result) if len(result) else None
def test_overwrite_selected_fields_only(self): project_slug = 'project-with-overwritten-data-specific-fields-only' description = 'project description' settings = '{"SETTING_KEY": "SETTING VALUE"}' is_public = True html_mail = False moderate_notifications = False is_archived = False plugins = ['linux-log-parser'] important_metadata_keys = 'important-key-1,important key 2' wait_before_notification_timeout = 60 notification_timeout = 120 data_retention = 1 project, errors = create_or_update_project( group_slug=self.group_slug, slug=project_slug, name='new name', description=description, settings=settings, is_public=is_public, html_mail=html_mail, moderate_notifications=moderate_notifications, is_archived=is_archived, plugins=plugins, important_metadata_keys=important_metadata_keys, wait_before_notification_timeout=wait_before_notification_timeout, notification_timeout=notification_timeout, data_retention=data_retention, ) self.assertIsNotNone(project) self.assertEqual(0, len(errors)) check_project = first( self.squad.projects(group__slug=self.group_slug, slug=project_slug)) self.assertEqualProjects(check_project, project) project_edited, errors = create_or_update_project( group_slug=self.group_slug, slug=project_slug, name='new name edited', overwrite=True, ) self.assertIsNotNone(project_edited) self.assertEqual(0, len(errors)) check_project = first( self.squad.projects(group__slug=self.group_slug, slug=project_slug)) self.assertEqualProjects(check_project, project_edited) self.assertEqual(description, project_edited.description) self.assertEqual(is_public, project_edited.is_public) self.assertEqual(html_mail, project_edited.html_mail) self.assertEqual(moderate_notifications, project_edited.moderate_notifications) self.assertEqual(is_archived, project_edited.is_archived) self.assertEqual(plugins, project_edited.enabled_plugins_list) self.assertEqual(important_metadata_keys, project_edited.important_metadata_keys) self.assertEqual(wait_before_notification_timeout, project_edited.wait_before_notification) self.assertEqual(notification_timeout, project_edited.notification_timeout) self.assertEqual(data_retention, project_edited.data_retention_days) project_edited.delete()
def build(self, version): filters = {'version': version} objects = self.builds(count=1, **filters) return first(objects)
def __setattr__(self, attr, value): if attr == 'environment' and value.startswith('http'): response = SquadApi.get(value) objs = self.__fill__(Environment, [response.json()]) value = first(objs) super(TestRun, self).__setattr__(attr, value)
def group(self, slug, **filters): filters.update({'slug': slug}) objects = self.groups(count=1, **filters) return first(objects)
def project(self, slug): filters = {'slug': slug} objects = self.projects(count=1, **filters) return first(objects)
def setUp(self): self.build = first(Squad().builds(version='my_build'))
def setUp(self): self.suite = first(Squad().suites(slug='my_suite'))
def setUp(self): SquadApi.configure(url='http://localhost:%s' % settings.DEFAULT_SQUAD_PORT, token='193cd8bb41ab9217714515954e8724f651ef8601') self.group = first(Squad().groups(slug='my_group'))
def test_save_project_settings(self): settings = 'SETTING: value' self.project.project_settings = settings self.project.save() project = first(Squad().projects(slug=self.project.slug)) self.assertTrue(project is not None)
def setUp(self): SquadApi.configure(url='http://localhost:%s' % settings.DEFAULT_SQUAD_PORT, token='193cd8bb41ab9217714515954e8724f651ef8601') self.project = first(Squad().projects(slug='my_project')) self.build = first(Squad().builds(version='my_build')) self.build2 = first(Squad().builds(version='my_build2'))