annotate rhodecode/tests/test_models.py @ 1556:1efca2908ae4 beta

fixes issue #248 cannot edit repos inside a group on windows
author Marcin Kuzminski <marcin@python-works.com>
date Thu, 13 Oct 2011 04:26:43 +0200
parents bd604cf75c5a
children 2c0d35e336b5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1538
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
1 import os
1373
66f03a87141c Fixes issue #201
Marcin Kuzminski <marcin@python-works.com>
parents: 547
diff changeset
2 import unittest
66f03a87141c Fixes issue #201
Marcin Kuzminski <marcin@python-works.com>
parents: 547
diff changeset
3 from rhodecode.tests import *
1538
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
4
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
5 from rhodecode.model.repos_group import ReposGroupModel
1539
bd604cf75c5a fixes #260 Put repo in group, then move group to another group -> repo becomes unavailable
Marcin Kuzminski <marcin@python-works.com>
parents: 1538
diff changeset
6 from rhodecode.model.repo import RepoModel
bd604cf75c5a fixes #260 Put repo in group, then move group to another group -> repo becomes unavailable
Marcin Kuzminski <marcin@python-works.com>
parents: 1538
diff changeset
7 from rhodecode.model.db import Group, User
1538
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
8 from sqlalchemy.exc import IntegrityError
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
9
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
10 class TestReposGroups(unittest.TestCase):
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
11
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
12 def setUp(self):
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
13 self.g1 = self.__make_group('test1', skip_if_exists=True)
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
14 self.g2 = self.__make_group('test2', skip_if_exists=True)
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
15 self.g3 = self.__make_group('test3', skip_if_exists=True)
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
16
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
17 def tearDown(self):
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
18 print 'out'
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
19
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
20 def __check_path(self, *path):
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
21 path = [TESTS_TMP_PATH] + list(path)
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
22 path = os.path.join(*path)
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
23 return os.path.isdir(path)
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
24
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
25 def _check_folders(self):
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
26 print os.listdir(TESTS_TMP_PATH)
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
27
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
28 def __make_group(self, path, desc='desc', parent_id=None,
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
29 skip_if_exists=False):
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
30
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
31 gr = Group.get_by_group_name(path)
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
32 if gr and skip_if_exists:
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
33 return gr
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
34
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
35 form_data = dict(group_name=path,
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
36 group_description=desc,
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
37 group_parent_id=parent_id)
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
38 gr = ReposGroupModel().create(form_data)
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
39 return gr
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
40
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
41 def __delete_group(self, id_):
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
42 ReposGroupModel().delete(id_)
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
43
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
44
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
45 def __update_group(self, id_, path, desc='desc', parent_id=None):
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
46 form_data = dict(group_name=path,
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
47 group_description=desc,
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
48 group_parent_id=parent_id)
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
49
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
50 gr = ReposGroupModel().update(id_, form_data)
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
51 return gr
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
52
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
53 def test_create_group(self):
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
54 g = self.__make_group('newGroup')
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
55 self.assertEqual(g.full_path, 'newGroup')
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
56
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
57 self.assertTrue(self.__check_path('newGroup'))
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
58
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
59
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
60 def test_create_same_name_group(self):
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
61 self.assertRaises(IntegrityError, lambda:self.__make_group('newGroup'))
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
62
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
63
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
64 def test_same_subgroup(self):
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
65 sg1 = self.__make_group('sub1', parent_id=self.g1.group_id)
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
66 self.assertEqual(sg1.parent_group, self.g1)
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
67 self.assertEqual(sg1.full_path, 'test1/sub1')
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
68 self.assertTrue(self.__check_path('test1', 'sub1'))
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
69
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
70 ssg1 = self.__make_group('subsub1', parent_id=sg1.group_id)
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
71 self.assertEqual(ssg1.parent_group, sg1)
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
72 self.assertEqual(ssg1.full_path, 'test1/sub1/subsub1')
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
73 self.assertTrue(self.__check_path('test1', 'sub1', 'subsub1'))
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
74
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
75
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
76 def test_remove_group(self):
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
77 sg1 = self.__make_group('deleteme')
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
78 self.__delete_group(sg1.group_id)
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
79
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
80 self.assertEqual(Group.get(sg1.group_id), None)
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
81 self.assertFalse(self.__check_path('deteteme'))
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
82
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
83 sg1 = self.__make_group('deleteme', parent_id=self.g1.group_id)
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
84 self.__delete_group(sg1.group_id)
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
85
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
86 self.assertEqual(Group.get(sg1.group_id), None)
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
87 self.assertFalse(self.__check_path('test1', 'deteteme'))
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
88
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
89
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
90 def test_rename_single_group(self):
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
91 sg1 = self.__make_group('initial')
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
92
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
93 new_sg1 = self.__update_group(sg1.group_id, 'after')
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
94 self.assertTrue(self.__check_path('after'))
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
95 self.assertEqual(Group.get_by_group_name('initial'), None)
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
96
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
97
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
98 def test_update_group_parent(self):
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
99
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
100 sg1 = self.__make_group('initial', parent_id=self.g1.group_id)
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
101
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
102 new_sg1 = self.__update_group(sg1.group_id, 'after', parent_id=self.g1.group_id)
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
103 self.assertTrue(self.__check_path('test1', 'after'))
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
104 self.assertEqual(Group.get_by_group_name('test1/initial'), None)
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
105
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
106
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
107 new_sg1 = self.__update_group(sg1.group_id, 'after', parent_id=self.g3.group_id)
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
108 self.assertTrue(self.__check_path('test3', 'after'))
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
109 self.assertEqual(Group.get_by_group_name('test3/initial'), None)
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
110
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
111
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
112 new_sg1 = self.__update_group(sg1.group_id, 'hello')
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
113 self.assertTrue(self.__check_path('hello'))
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
114
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
115 self.assertEqual(Group.get_by_group_name('hello'), new_sg1)
27be8f94c207 implements #226 repo groups available by path
Marcin Kuzminski <marcin@python-works.com>
parents: 1373
diff changeset
116
1539
bd604cf75c5a fixes #260 Put repo in group, then move group to another group -> repo becomes unavailable
Marcin Kuzminski <marcin@python-works.com>
parents: 1538
diff changeset
117
bd604cf75c5a fixes #260 Put repo in group, then move group to another group -> repo becomes unavailable
Marcin Kuzminski <marcin@python-works.com>
parents: 1538
diff changeset
118
bd604cf75c5a fixes #260 Put repo in group, then move group to another group -> repo becomes unavailable
Marcin Kuzminski <marcin@python-works.com>
parents: 1538
diff changeset
119 def test_subgrouping_with_repo(self):
bd604cf75c5a fixes #260 Put repo in group, then move group to another group -> repo becomes unavailable
Marcin Kuzminski <marcin@python-works.com>
parents: 1538
diff changeset
120
bd604cf75c5a fixes #260 Put repo in group, then move group to another group -> repo becomes unavailable
Marcin Kuzminski <marcin@python-works.com>
parents: 1538
diff changeset
121 g1 = self.__make_group('g1')
bd604cf75c5a fixes #260 Put repo in group, then move group to another group -> repo becomes unavailable
Marcin Kuzminski <marcin@python-works.com>
parents: 1538
diff changeset
122 g2 = self.__make_group('g2')
bd604cf75c5a fixes #260 Put repo in group, then move group to another group -> repo becomes unavailable
Marcin Kuzminski <marcin@python-works.com>
parents: 1538
diff changeset
123
bd604cf75c5a fixes #260 Put repo in group, then move group to another group -> repo becomes unavailable
Marcin Kuzminski <marcin@python-works.com>
parents: 1538
diff changeset
124 # create new repo
bd604cf75c5a fixes #260 Put repo in group, then move group to another group -> repo becomes unavailable
Marcin Kuzminski <marcin@python-works.com>
parents: 1538
diff changeset
125 form_data = dict(repo_name='john',
bd604cf75c5a fixes #260 Put repo in group, then move group to another group -> repo becomes unavailable
Marcin Kuzminski <marcin@python-works.com>
parents: 1538
diff changeset
126 repo_name_full='john',
bd604cf75c5a fixes #260 Put repo in group, then move group to another group -> repo becomes unavailable
Marcin Kuzminski <marcin@python-works.com>
parents: 1538
diff changeset
127 fork_name=None,
bd604cf75c5a fixes #260 Put repo in group, then move group to another group -> repo becomes unavailable
Marcin Kuzminski <marcin@python-works.com>
parents: 1538
diff changeset
128 description=None,
bd604cf75c5a fixes #260 Put repo in group, then move group to another group -> repo becomes unavailable
Marcin Kuzminski <marcin@python-works.com>
parents: 1538
diff changeset
129 repo_group=None,
bd604cf75c5a fixes #260 Put repo in group, then move group to another group -> repo becomes unavailable
Marcin Kuzminski <marcin@python-works.com>
parents: 1538
diff changeset
130 private=False,
bd604cf75c5a fixes #260 Put repo in group, then move group to another group -> repo becomes unavailable
Marcin Kuzminski <marcin@python-works.com>
parents: 1538
diff changeset
131 repo_type='hg',
bd604cf75c5a fixes #260 Put repo in group, then move group to another group -> repo becomes unavailable
Marcin Kuzminski <marcin@python-works.com>
parents: 1538
diff changeset
132 clone_uri=None)
bd604cf75c5a fixes #260 Put repo in group, then move group to another group -> repo becomes unavailable
Marcin Kuzminski <marcin@python-works.com>
parents: 1538
diff changeset
133 cur_user = User.get_by_username(TEST_USER_ADMIN_LOGIN)
bd604cf75c5a fixes #260 Put repo in group, then move group to another group -> repo becomes unavailable
Marcin Kuzminski <marcin@python-works.com>
parents: 1538
diff changeset
134 r = RepoModel().create(form_data, cur_user)
bd604cf75c5a fixes #260 Put repo in group, then move group to another group -> repo becomes unavailable
Marcin Kuzminski <marcin@python-works.com>
parents: 1538
diff changeset
135
bd604cf75c5a fixes #260 Put repo in group, then move group to another group -> repo becomes unavailable
Marcin Kuzminski <marcin@python-works.com>
parents: 1538
diff changeset
136 self.assertEqual(r.repo_name, 'john')
bd604cf75c5a fixes #260 Put repo in group, then move group to another group -> repo becomes unavailable
Marcin Kuzminski <marcin@python-works.com>
parents: 1538
diff changeset
137
bd604cf75c5a fixes #260 Put repo in group, then move group to another group -> repo becomes unavailable
Marcin Kuzminski <marcin@python-works.com>
parents: 1538
diff changeset
138 # put repo into group
bd604cf75c5a fixes #260 Put repo in group, then move group to another group -> repo becomes unavailable
Marcin Kuzminski <marcin@python-works.com>
parents: 1538
diff changeset
139 form_data = form_data
bd604cf75c5a fixes #260 Put repo in group, then move group to another group -> repo becomes unavailable
Marcin Kuzminski <marcin@python-works.com>
parents: 1538
diff changeset
140 form_data['repo_group'] = g1.group_id
bd604cf75c5a fixes #260 Put repo in group, then move group to another group -> repo becomes unavailable
Marcin Kuzminski <marcin@python-works.com>
parents: 1538
diff changeset
141 form_data['perms_new'] = []
bd604cf75c5a fixes #260 Put repo in group, then move group to another group -> repo becomes unavailable
Marcin Kuzminski <marcin@python-works.com>
parents: 1538
diff changeset
142 form_data['perms_updates'] = []
bd604cf75c5a fixes #260 Put repo in group, then move group to another group -> repo becomes unavailable
Marcin Kuzminski <marcin@python-works.com>
parents: 1538
diff changeset
143 RepoModel().update(r.repo_name, form_data)
bd604cf75c5a fixes #260 Put repo in group, then move group to another group -> repo becomes unavailable
Marcin Kuzminski <marcin@python-works.com>
parents: 1538
diff changeset
144 self.assertEqual(r.repo_name, 'g1/john')
bd604cf75c5a fixes #260 Put repo in group, then move group to another group -> repo becomes unavailable
Marcin Kuzminski <marcin@python-works.com>
parents: 1538
diff changeset
145
bd604cf75c5a fixes #260 Put repo in group, then move group to another group -> repo becomes unavailable
Marcin Kuzminski <marcin@python-works.com>
parents: 1538
diff changeset
146
bd604cf75c5a fixes #260 Put repo in group, then move group to another group -> repo becomes unavailable
Marcin Kuzminski <marcin@python-works.com>
parents: 1538
diff changeset
147 self.__update_group(g1.group_id, 'g1', parent_id=g2.group_id)
bd604cf75c5a fixes #260 Put repo in group, then move group to another group -> repo becomes unavailable
Marcin Kuzminski <marcin@python-works.com>
parents: 1538
diff changeset
148 self.assertTrue(self.__check_path('g2', 'g1'))
bd604cf75c5a fixes #260 Put repo in group, then move group to another group -> repo becomes unavailable
Marcin Kuzminski <marcin@python-works.com>
parents: 1538
diff changeset
149
bd604cf75c5a fixes #260 Put repo in group, then move group to another group -> repo becomes unavailable
Marcin Kuzminski <marcin@python-works.com>
parents: 1538
diff changeset
150 # test repo
bd604cf75c5a fixes #260 Put repo in group, then move group to another group -> repo becomes unavailable
Marcin Kuzminski <marcin@python-works.com>
parents: 1538
diff changeset
151 self.assertEqual(r.repo_name, os.path.join('g2', 'g1', r.just_name))
bd604cf75c5a fixes #260 Put repo in group, then move group to another group -> repo becomes unavailable
Marcin Kuzminski <marcin@python-works.com>
parents: 1538
diff changeset
152
bd604cf75c5a fixes #260 Put repo in group, then move group to another group -> repo becomes unavailable
Marcin Kuzminski <marcin@python-works.com>
parents: 1538
diff changeset
153