##// END OF EJS Templates
tests: improved test utils....
marcink -
r1442:0bf8c0ea default
parent child Browse files
Show More
@@ -1170,11 +1170,14 b' class UserUtility(object):'
1170 user_group = self.create_user_group(members=[user])
1170 user_group = self.create_user_group(members=[user])
1171 return user, user_group
1171 return user, user_group
1172
1172
1173 def create_user_group(self, members=None, auto_cleanup=True, **kwargs):
1173 def create_user_group(self, owner=TEST_USER_ADMIN_LOGIN, members=None,
1174 auto_cleanup=True, **kwargs):
1174 group_name = "{prefix}_usergroup_{count}".format(
1175 group_name = "{prefix}_usergroup_{count}".format(
1175 prefix=self._test_name,
1176 prefix=self._test_name,
1176 count=len(self.user_group_ids))
1177 count=len(self.user_group_ids))
1177 user_group = self.fixture.create_user_group(group_name, **kwargs)
1178 user_group = self.fixture.create_user_group(
1179 group_name, cur_user=owner, **kwargs)
1180
1178 if auto_cleanup:
1181 if auto_cleanup:
1179 self.user_group_ids.append(user_group.users_group_id)
1182 self.user_group_ids.append(user_group.users_group_id)
1180 if members:
1183 if members:
@@ -241,14 +241,14 b' class AssertResponse(object):'
241 doc = fromstring(self.response.body)
241 doc = fromstring(self.response.body)
242 sel = CSSSelector('#' + anchor_id)
242 sel = CSSSelector('#' + anchor_id)
243 elements = sel(doc)
243 elements = sel(doc)
244 assert len(elements) == 1
244 assert len(elements) == 1, 'cannot find 1 element {}'.format(anchor_id)
245
245
246 def _ensure_url_equal(self, found, expected):
246 def _ensure_url_equal(self, found, expected):
247 assert _Url(found) == _Url(expected)
247 assert _Url(found) == _Url(expected)
248
248
249 def get_element(self, css_selector):
249 def get_element(self, css_selector):
250 elements = self._get_elements(css_selector)
250 elements = self._get_elements(css_selector)
251 assert len(elements) == 1
251 assert len(elements) == 1, 'cannot find 1 element {}'.format(css_selector)
252 return elements[0]
252 return elements[0]
253
253
254 def get_elements(self, css_selector):
254 def get_elements(self, css_selector):
General Comments 0
You need to be logged in to leave comments. Login now