Show More
@@ -1138,6 +1138,7 b' class UserUtility(object):' | |||||
1138 | self._test_name = self._sanitize_name(test_name) |
|
1138 | self._test_name = self._sanitize_name(test_name) | |
1139 | self.fixture = Fixture() |
|
1139 | self.fixture = Fixture() | |
1140 | self.repo_group_ids = [] |
|
1140 | self.repo_group_ids = [] | |
|
1141 | self.repos_ids = [] | |||
1141 | self.user_ids = [] |
|
1142 | self.user_ids = [] | |
1142 | self.user_group_ids = [] |
|
1143 | self.user_group_ids = [] | |
1143 | self.user_repo_permission_ids = [] |
|
1144 | self.user_repo_permission_ids = [] | |
@@ -1164,6 +1165,17 b' class UserUtility(object):' | |||||
1164 | self.repo_group_ids.append(repo_group.group_id) |
|
1165 | self.repo_group_ids.append(repo_group.group_id) | |
1165 | return repo_group |
|
1166 | return repo_group | |
1166 |
|
1167 | |||
|
1168 | def create_repo(self, owner=TEST_USER_ADMIN_LOGIN, parent=None, auto_cleanup=True): | |||
|
1169 | repo_name = "{prefix}_repository_{count}".format( | |||
|
1170 | prefix=self._test_name, | |||
|
1171 | count=len(self.repos_ids)) | |||
|
1172 | ||||
|
1173 | repository = self.fixture.create_repo( | |||
|
1174 | repo_name, cur_user=owner, repo_group=parent) | |||
|
1175 | if auto_cleanup: | |||
|
1176 | self.repos_ids.append(repository.repo_id) | |||
|
1177 | return repository | |||
|
1178 | ||||
1167 | def create_user(self, auto_cleanup=True, **kwargs): |
|
1179 | def create_user(self, auto_cleanup=True, **kwargs): | |
1168 | user_name = "{prefix}_user_{count}".format( |
|
1180 | user_name = "{prefix}_user_{count}".format( | |
1169 | prefix=self._test_name, |
|
1181 | prefix=self._test_name, | |
@@ -1254,6 +1266,7 b' class UserUtility(object):' | |||||
1254 |
|
1266 | |||
1255 | def cleanup(self): |
|
1267 | def cleanup(self): | |
1256 | self._cleanup_permissions() |
|
1268 | self._cleanup_permissions() | |
|
1269 | self._cleanup_repos() | |||
1257 | self._cleanup_repo_groups() |
|
1270 | self._cleanup_repo_groups() | |
1258 | self._cleanup_user_groups() |
|
1271 | self._cleanup_user_groups() | |
1259 | self._cleanup_users() |
|
1272 | self._cleanup_users() | |
@@ -1299,6 +1312,11 b' class UserUtility(object):' | |||||
1299 | for repo_group_id in sorted_repo_group_ids: |
|
1312 | for repo_group_id in sorted_repo_group_ids: | |
1300 | self.fixture.destroy_repo_group(repo_group_id) |
|
1313 | self.fixture.destroy_repo_group(repo_group_id) | |
1301 |
|
1314 | |||
|
1315 | def _cleanup_repos(self): | |||
|
1316 | sorted_repos_ids = sorted(self.repos_ids) | |||
|
1317 | for repo_id in sorted_repos_ids: | |||
|
1318 | self.fixture.destroy_repo(repo_id) | |||
|
1319 | ||||
1302 | def _cleanup_user_groups(self): |
|
1320 | def _cleanup_user_groups(self): | |
1303 | def _user_group_compare(first_group_id, second_group_id): |
|
1321 | def _user_group_compare(first_group_id, second_group_id): | |
1304 | """ |
|
1322 | """ |
General Comments 0
You need to be logged in to leave comments.
Login now