-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Revert "Merge pull request #3336 from rtfd/use-active-for-stable" #3368
Changes from 4 commits
562692e
6d47a9b
e8bf5c2
39f7598
b4a9fd7
5f6917c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -349,9 +349,6 @@ def test_update_stable_version(self): | |
self.assertEqual(version_stable.identifier, '1.0.0') | ||
|
||
def test_update_inactive_stable_version(self): | ||
""" | ||
Test that stable doesn't get updated when it isn't active | ||
""" | ||
version_post_data = { | ||
'branches': [ | ||
{ | ||
|
@@ -391,7 +388,7 @@ def test_update_inactive_stable_version(self): | |
|
||
version_stable = Version.objects.get(slug=STABLE) | ||
self.assertFalse(version_stable.active) | ||
self.assertEqual(version_stable.identifier, '0.9') | ||
self.assertEqual(version_stable.identifier, '1.0.0') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't this test be for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yea, that was the original fix. |
||
|
||
def test_stable_version_tags_over_branches(self): | ||
version_post_data = { | ||
|
@@ -471,3 +468,79 @@ def test_unicode(self): | |
content_type='application/json', | ||
) | ||
self.assertEqual(resp.status_code, 200) | ||
|
||
def test_user_defined_stable_version_with_tags(self): | ||
|
||
Version.objects.create( | ||
project=self.pip, | ||
identifier='0.8.3', | ||
verbose_name='0.8.3', | ||
active=True, | ||
) | ||
|
||
Version.objects.create( | ||
project=self.pip, | ||
identifier='foo', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm tested it gets updated from a prior "set" version. |
||
type='branch', | ||
verbose_name='stable', | ||
active=True, | ||
machine=True, | ||
) | ||
|
||
version_post_data = { | ||
'branches': [ | ||
{ | ||
'identifier': 'origin/master', | ||
'verbose_name': 'master', | ||
}, | ||
{ | ||
'identifier': 'origin/stable', | ||
'verbose_name': 'stable', | ||
}, | ||
{ | ||
'identifier': 'origin/to_add', | ||
'verbose_name': 'to_add', | ||
}, | ||
], | ||
'tags': [ | ||
{ | ||
'identifier': '0.9', | ||
'verbose_name': '0.9', | ||
}, | ||
{ | ||
'identifier': '0.8.3', | ||
'verbose_name': '0.8.3', | ||
}, | ||
], | ||
} | ||
|
||
self.client.post( | ||
'/api/v2/project/{}/sync_versions/'.format(self.pip.pk), | ||
data=json.dumps(version_post_data), | ||
content_type='application/json', | ||
) | ||
|
||
version_9 = Version.objects.get(slug='0.9') | ||
self.assertFalse(version_9.active) | ||
|
||
version_stable = Version.objects.get(slug='stable') | ||
self.assertFalse(version_stable.machine) | ||
self.assertTrue(version_stable.active) | ||
|
||
# Version 0.9 doesn't become stable, since we already had a user-defined stable | ||
self.assertEqual( | ||
'origin/stable', | ||
self.pip.get_stable_version().identifier, | ||
) | ||
|
||
self.client.post( | ||
'/api/v2/project/{}/sync_versions/'.format(self.pip.pk), | ||
data=json.dumps(version_post_data), | ||
content_type='application/json', | ||
) | ||
|
||
# Version 0.9 doesn't become stable, since we already had a user-defined stable | ||
self.assertEqual( | ||
'origin/stable', | ||
self.pip.get_stable_version().identifier, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, comparing this with the original code, we are just adding a another condition (has to be
active
) but we keep themachine
.In other words, we are just updating the stable version only if, the identifier changed (a new tag become the stable, for example) and the stable version is active and it was created by RTD.
If what I'm saying is correct, I think we are OK :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, thats the goal :)