##// END OF EJS Templates
fixes issue #366 setting null on parent_group didn't propagate to actually db field....
marcink -
r2059:d7f1fe9c beta
parent child Browse files
Show More
@@ -21,6 +21,8 b' fixes'
21 - fixed git remote repos validator that prevented from cloning remote git repos
21 - fixed git remote repos validator that prevented from cloning remote git repos
22 - fixes #370 ending slashes fixes for repo and groups
22 - fixes #370 ending slashes fixes for repo and groups
23 - fixes #368 improved git-protocol detection to handle other clients
23 - fixes #368 improved git-protocol detection to handle other clients
24 - fixes #366 When Setting Repository Group To Blank Repo Group Wont Be
25 Moved To Root
24
26
25 1.3.1 (**2012-02-27**)
27 1.3.1 (**2012-02-27**)
26 ----------------------
28 ----------------------
@@ -187,20 +187,20 b' class ReposGroupModel(BaseModel):'
187 # change properties
187 # change properties
188 repos_group.group_description = form_data['group_description']
188 repos_group.group_description = form_data['group_description']
189 repos_group.parent_group = RepoGroup.get(form_data['group_parent_id'])
189 repos_group.parent_group = RepoGroup.get(form_data['group_parent_id'])
190 repos_group.group_parent_id = form_data['group_parent_id']
190 repos_group.group_name = repos_group.get_new_name(form_data['group_name'])
191 repos_group.group_name = repos_group.get_new_name(form_data['group_name'])
191
192 new_path = repos_group.full_path
192 new_path = repos_group.full_path
193
193
194 self.sa.add(repos_group)
194 self.sa.add(repos_group)
195
195
196 self.__rename_group(old_path, new_path)
197
198 # we need to get all repositories from this new group and
196 # we need to get all repositories from this new group and
199 # rename them accordingly to new group path
197 # rename them accordingly to new group path
200 for r in repos_group.repositories:
198 for r in repos_group.repositories:
201 r.repo_name = r.get_new_name(r.just_name)
199 r.repo_name = r.get_new_name(r.just_name)
202 self.sa.add(r)
200 self.sa.add(r)
203
201
202 self.__rename_group(old_path, new_path)
203
204 return repos_group
204 return repos_group
205 except:
205 except:
206 log.error(traceback.format_exc())
206 log.error(traceback.format_exc())
@@ -23,7 +23,6 b" def _make_group(path, desc='desc', paren"
23 return gr
23 return gr
24
24
25 gr = ReposGroupModel().create(path, desc, parent_id)
25 gr = ReposGroupModel().create(path, desc, parent_id)
26 Session.commit()
27 return gr
26 return gr
28
27
29
28
@@ -31,13 +30,19 b' class TestReposGroups(unittest.TestCase)'
31
30
32 def setUp(self):
31 def setUp(self):
33 self.g1 = _make_group('test1', skip_if_exists=True)
32 self.g1 = _make_group('test1', skip_if_exists=True)
33 Session.commit()
34 self.g2 = _make_group('test2', skip_if_exists=True)
34 self.g2 = _make_group('test2', skip_if_exists=True)
35 Session.commit()
35 self.g3 = _make_group('test3', skip_if_exists=True)
36 self.g3 = _make_group('test3', skip_if_exists=True)
37 Session.commit()
36
38
37 def tearDown(self):
39 def tearDown(self):
38 print 'out'
40 print 'out'
39
41
40 def __check_path(self, *path):
42 def __check_path(self, *path):
43 """
44 Checks the path for existance !
45 """
41 path = [TESTS_TMP_PATH] + list(path)
46 path = [TESTS_TMP_PATH] + list(path)
42 path = os.path.join(*path)
47 path = os.path.join(*path)
43 return os.path.isdir(path)
48 return os.path.isdir(path)
@@ -49,12 +54,13 b' class TestReposGroups(unittest.TestCase)'
49 ReposGroupModel().delete(id_)
54 ReposGroupModel().delete(id_)
50
55
51 def __update_group(self, id_, path, desc='desc', parent_id=None):
56 def __update_group(self, id_, path, desc='desc', parent_id=None):
52 form_data = dict(group_name=path,
57 form_data = dict(
53 group_description=desc,
58 group_name=path,
54 group_parent_id=parent_id,
59 group_description=desc,
55 perms_updates=[],
60 group_parent_id=parent_id,
56 perms_new=[])
61 perms_updates=[],
57
62 perms_new=[]
63 )
58 gr = ReposGroupModel().update(id_, form_data)
64 gr = ReposGroupModel().update(id_, form_data)
59 return gr
65 return gr
60
66
@@ -150,6 +156,25 b' class TestReposGroups(unittest.TestCase)'
150 self.assertEqual(r.repo_name, os.path.join('g2', 'g1', r.just_name))
156 self.assertEqual(r.repo_name, os.path.join('g2', 'g1', r.just_name))
151
157
152
158
159 def test_move_to_root(self):
160 g1 = _make_group('t11')
161 Session.commit()
162 g2 = _make_group('t22',parent_id=g1.group_id)
163 Session.commit()
164
165 self.assertEqual(g2.full_path,'t11/t22')
166 self.assertTrue(self.__check_path('t11', 't22'))
167
168 g2 = self.__update_group(g2.group_id, 'g22', parent_id=None)
169 Session.commit()
170
171 self.assertEqual(g2.group_name,'g22')
172 # we moved out group from t1 to '' so it's full path should be 'g2'
173 self.assertEqual(g2.full_path,'g22')
174 self.assertFalse(self.__check_path('t11', 't22'))
175 self.assertTrue(self.__check_path('g22'))
176
177
153 class TestUser(unittest.TestCase):
178 class TestUser(unittest.TestCase):
154 def __init__(self, methodName='runTest'):
179 def __init__(self, methodName='runTest'):
155 Session.remove()
180 Session.remove()
General Comments 0
You need to be logged in to leave comments. Login now