Show More
@@ -1850,6 +1850,47 b' class _BaseTestApi(object):' | |||||
1850 | ) |
|
1850 | ) | |
1851 | self._compare_error(id_, expected, given=response.body) |
|
1851 | self._compare_error(id_, expected, given=response.body) | |
1852 |
|
1852 | |||
|
1853 | @base.parametrize('changing_attr,updates', [ | |||
|
1854 | #('owner', {'owner': base.TEST_USER_REGULAR_LOGIN}), # currently broken | |||
|
1855 | ('description', {'description': 'new description'}), | |||
|
1856 | ('group_name', {'group_name': 'new_repo_name'}), | |||
|
1857 | #('parent', {'parent': 'test_group_for_update'}), # currently broken | |||
|
1858 | ]) | |||
|
1859 | def test_api_update_repo_group(self, changing_attr, updates): | |||
|
1860 | group_name = 'lololo' | |||
|
1861 | repo_group = fixture.create_repo_group(group_name) | |||
|
1862 | ||||
|
1863 | new_group_name = group_name | |||
|
1864 | if changing_attr == 'group_name': | |||
|
1865 | assert repo_group.parent_group_id is None # lazy assumption for this test | |||
|
1866 | new_group_name = updates['group_name'] | |||
|
1867 | if changing_attr == 'parent': | |||
|
1868 | new_group_name = '/'.join([updates['parent'], group_name.rsplit('/', 1)[-1]]) | |||
|
1869 | ||||
|
1870 | expected = { | |||
|
1871 | 'msg': 'updated repository group ID:%s %s' % (repo_group.group_id, new_group_name), | |||
|
1872 | 'repo_group': repo_group.get_api_data() | |||
|
1873 | } | |||
|
1874 | expected['repo_group'].update(updates) | |||
|
1875 | if 'description' in updates: | |||
|
1876 | expected['repo_group']['group_description'] = expected['repo_group'].pop('description') | |||
|
1877 | ||||
|
1878 | if changing_attr == 'parent': | |||
|
1879 | new_parent = fixture.create_repo_group(updates['parent']) | |||
|
1880 | expected['repo_group']['parent_group'] = expected['repo_group'].pop('parent') | |||
|
1881 | expected['repo_group']['group_name'] = new_group_name | |||
|
1882 | ||||
|
1883 | id_, params = _build_data(self.apikey, 'update_repo_group', | |||
|
1884 | repogroupid=group_name, **updates) | |||
|
1885 | response = api_call(self, params) | |||
|
1886 | ||||
|
1887 | try: | |||
|
1888 | self._compare_ok(id_, expected, given=response.body) | |||
|
1889 | finally: | |||
|
1890 | if changing_attr == 'parent': | |||
|
1891 | fixture.destroy_repo_group(new_parent.group_id) | |||
|
1892 | fixture.destroy_repo_group(new_group_name) | |||
|
1893 | ||||
1853 | @base.parametrize('name,perm,apply_to_children', [ |
|
1894 | @base.parametrize('name,perm,apply_to_children', [ | |
1854 | ('none', 'group.none', 'none'), |
|
1895 | ('none', 'group.none', 'none'), | |
1855 | ('read', 'group.read', 'none'), |
|
1896 | ('read', 'group.read', 'none'), |
General Comments 0
You need to be logged in to leave comments.
Login now