@@ -670,6 +670,55 @@ def test_machine_attr_when_user_define_stable_branch_and_delete_it_new_project(
670
670
)
671
671
self .assertTrue (current_stable .machine )
672
672
673
+ def test_restore_machine_stable_verbose_name (self ):
674
+ """
675
+ The user imports a new project with a branch named ``Stable``, when
676
+ syncing the versions, the RTD's ``stable`` is lost (set to machine=False)
677
+ and doesn't update automatically anymore, when the branch
678
+ is deleted on the user repository, the RTD's ``stable`` is back
679
+ (set to machine=True, and with the correct name in lowercase).
680
+ """
681
+ self .pip .versions .exclude (slug = "master" ).delete ()
682
+ current_stable = self .pip .get_stable_version ()
683
+ assert current_stable is None
684
+
685
+ custom_stable = get (
686
+ Version ,
687
+ project = self .pip ,
688
+ identifier = "Stable" ,
689
+ verbose_name = "Stable" ,
690
+ slug = "stable" ,
691
+ type = BRANCH ,
692
+ machine = False ,
693
+ active = True ,
694
+ )
695
+ self .pip .update_stable_version ()
696
+
697
+ assert self .pip .get_stable_version () == custom_stable
698
+
699
+ branches_data = [
700
+ {
701
+ "identifier" : "master" ,
702
+ "verbose_name" : "master" ,
703
+ },
704
+ {
705
+ "identifier" : "0.8.3" ,
706
+ "verbose_name" : "0.8.3" ,
707
+ },
708
+ ]
709
+
710
+ sync_versions_task (
711
+ self .pip .pk ,
712
+ branches_data = branches_data ,
713
+ tags_data = [],
714
+ )
715
+
716
+ # RTD stable is restored correctly.
717
+ current_stable = self .pip .get_stable_version ()
718
+ assert current_stable .identifier == "0.8.3"
719
+ assert current_stable .verbose_name == "stable"
720
+ assert current_stable .machine
721
+
673
722
def test_machine_attr_when_user_define_latest_tag_and_delete_it (self ):
674
723
"""The user creates a tag named ``latest`` on an existing repo, when
675
724
syncing the versions, the RTD's ``latest`` is lost (set to
0 commit comments