Show More
@@ -37,27 +37,24 b' class SAME_AS_UPDATES(object): """ Const' | |||||
37 | @pytest.mark.usefixtures("testuser_api", "app") |
|
37 | @pytest.mark.usefixtures("testuser_api", "app") | |
38 | class TestApiUpdateRepo(object): |
|
38 | class TestApiUpdateRepo(object): | |
39 |
|
39 | |||
40 |
@pytest.mark.parametrize(" |
|
40 | @pytest.mark.parametrize("updates, expected", [ | |
41 |
( |
|
41 | ({'owner': TEST_USER_REGULAR_LOGIN}, SAME_AS_UPDATES), | |
42 |
( |
|
42 | ({'description': 'new description'}, SAME_AS_UPDATES), | |
43 |
( |
|
43 | ({'clone_uri': 'http://foo.com/repo'}, SAME_AS_UPDATES), | |
44 |
( |
|
44 | ({'clone_uri': None}, {'clone_uri': ''}), | |
45 |
( |
|
45 | ({'clone_uri': ''}, {'clone_uri': ''}), | |
46 |
( |
|
46 | ({'landing_rev': 'branch:master'}, {'landing_rev': ['branch','master']}), | |
47 | {'landing_rev': ['branch', 'master']}), |
|
47 | ({'enable_statistics': True}, SAME_AS_UPDATES), | |
48 |
( |
|
48 | ({'enable_locking': True}, SAME_AS_UPDATES), | |
49 |
( |
|
49 | ({'enable_downloads': True}, SAME_AS_UPDATES), | |
50 | ('enable_downloads', {'enable_downloads': True}, SAME_AS_UPDATES), |
|
50 | ({'name': 'new_repo_name'}, {'repo_name': 'new_repo_name'}), | |
51 | ('name', {'name': 'new_repo_name'}, |
|
51 | ({'group': 'test_group_for_update'}, | |
52 | {'repo_name': 'new_repo_name'}), |
|
|||
53 | ('repo_group', |
|
|||
54 | {'group': 'test_group_for_update'}, |
|
|||
55 | {'repo_name': 'test_group_for_update/%s' % UPDATE_REPO_NAME}), |
|
52 | {'repo_name': 'test_group_for_update/%s' % UPDATE_REPO_NAME}), | |
56 | ]) |
|
53 | ]) | |
57 |
def test_api_update_repo(self |
|
54 | def test_api_update_repo(self, updates, expected, backend): | |
58 | repo_name = UPDATE_REPO_NAME |
|
55 | repo_name = UPDATE_REPO_NAME | |
59 | repo = fixture.create_repo(repo_name, repo_type=backend.alias) |
|
56 | repo = fixture.create_repo(repo_name, repo_type=backend.alias) | |
60 |
if |
|
57 | if updates.get('group'): | |
61 | fixture.create_repo_group(updates['group']) |
|
58 | fixture.create_repo_group(updates['group']) | |
62 |
|
59 | |||
63 | expected_api_data = repo.get_api_data(include_secrets=True) |
|
60 | expected_api_data = repo.get_api_data(include_secrets=True) | |
@@ -71,9 +68,9 b' class TestApiUpdateRepo(object):' | |||||
71 | self.apikey, 'update_repo', repoid=repo_name, **updates) |
|
68 | self.apikey, 'update_repo', repoid=repo_name, **updates) | |
72 | response = api_call(self.app, params) |
|
69 | response = api_call(self.app, params) | |
73 |
|
70 | |||
74 |
if |
|
71 | if updates.get('name'): | |
75 | repo_name = updates['name'] |
|
72 | repo_name = updates['name'] | |
76 |
if |
|
73 | if updates.get('group'): | |
77 | repo_name = '/'.join([updates['group'], repo_name]) |
|
74 | repo_name = '/'.join([updates['group'], repo_name]) | |
78 |
|
75 | |||
79 | try: |
|
76 | try: | |
@@ -84,7 +81,7 b' class TestApiUpdateRepo(object):' | |||||
84 | assert_ok(id_, expected, given=response.body) |
|
81 | assert_ok(id_, expected, given=response.body) | |
85 | finally: |
|
82 | finally: | |
86 | fixture.destroy_repo(repo_name) |
|
83 | fixture.destroy_repo(repo_name) | |
87 |
if |
|
84 | if updates.get('group'): | |
88 | fixture.destroy_repo_group(updates['group']) |
|
85 | fixture.destroy_repo_group(updates['group']) | |
89 |
|
86 | |||
90 | def test_api_update_repo_fork_of_field(self, backend): |
|
87 | def test_api_update_repo_fork_of_field(self, backend): |
General Comments 0
You need to be logged in to leave comments.
Login now