22from flask import request
33
44from tests .base import OsfTestCase
5- from website .ember_osf_web .decorators import ember_flag_is_active
5+ from website .external_web_app .decorators import ember_flag_is_active
66from osf_tests .factories import FlagFactory , UserFactory
77
88from django .contrib .auth .models import Group
@@ -16,24 +16,26 @@ def setUp(self):
1616 FlagFactory (name = 'inactive_flag' , everyone = False ).save ()
1717 self .mock_func = lambda : 'test value'
1818
19- @mock .patch ('website.ember_osf_web.decorators.use_ember_app' )
20- def test_use_ember_app (self , mock_use_ember_app ):
19+ # TODO: This test case is not Ember App specific.
20+ @mock .patch ('website.external_web_app.decorators.use_primary_web_app' )
21+ def test_use_primary_web_app (self , mock_use_primary_web_app ):
2122 ember_flag_is_active ('active_flag' )(self .mock_func )()
2223
23- mock_use_ember_app .assert_called_with ()
24+ mock_use_primary_web_app .assert_called_with ()
2425
25- @mock .patch ('website.ember_osf_web.decorators.use_ember_app' )
26- def test_dont_use_ember_app (self , mock_use_ember_app ):
26+ # TODO: This test case is not Ember App specific.
27+ @mock .patch ('website.external_web_app.decorators.use_primary_web_app' )
28+ def test_dont_use_primary_web_app (self , mock_use_primary_web_app ):
2729 # mock over external module 'waflle.flag_is_active` not ours
2830
2931 ember_flag_is_active ('inactive_flag' )(self .mock_func )()
3032
31- assert not mock_use_ember_app .called
33+ assert not mock_use_primary_web_app .called
3234
3335 @mock .patch ('api.waffle.utils._get_current_user' )
34- @mock .patch ('website.ember_osf_web .decorators.flag_is_active' )
35- @mock .patch ('website.ember_osf_web .decorators.use_ember_app ' )
36- def test_ember_flag_is_active_authenticated_user (self , mock_use_ember_app , mock_flag_is_active , mock__get_current_user ):
36+ @mock .patch ('website.external_web_app .decorators.flag_is_active' )
37+ @mock .patch ('website.external_web_app .decorators.use_primary_web_app ' )
38+ def test_ember_flag_is_active_authenticated_user (self , mock_use_primary_web_app , mock_flag_is_active , mock__get_current_user ):
3739 # mock over external module 'waflle.flag_is_active` not ours
3840
3941 user = UserFactory ()
@@ -42,12 +44,12 @@ def test_ember_flag_is_active_authenticated_user(self, mock_use_ember_app, mock_
4244 ember_flag_is_active ('active_flag' )(self .mock_func )()
4345
4446 mock_flag_is_active .assert_called_with (request , 'active_flag' )
45- mock_use_ember_app .assert_called_with ()
47+ mock_use_primary_web_app .assert_called_with ()
4648
4749 @mock .patch ('api.waffle.utils._get_current_user' , return_value = None )
48- @mock .patch ('website.ember_osf_web .decorators.flag_is_active' )
49- @mock .patch ('website.ember_osf_web .decorators.use_ember_app ' )
50- def test_ember_flag_is_active_unauthenticated_user (self , mock_use_ember_app , mock_flag_is_active , mock__get_current_user ):
50+ @mock .patch ('website.external_web_app .decorators.flag_is_active' )
51+ @mock .patch ('website.external_web_app .decorators.use_primary_web_app ' )
52+ def test_ember_flag_is_active_unauthenticated_user (self , mock_use_primary_web_app , mock_flag_is_active , mock__get_current_user ):
5153 # mock over external module 'waflle.flag_is_active` not ours
5254
5355 ember_flag_is_active ('active_flag' )(self .mock_func )()
@@ -56,4 +58,4 @@ def test_ember_flag_is_active_unauthenticated_user(self, mock_use_ember_app, moc
5658 self .flag .groups .add (group )
5759
5860 mock_flag_is_active .assert_called_with (request , 'active_flag' )
59- mock_use_ember_app .assert_called_with ()
61+ mock_use_primary_web_app .assert_called_with ()
0 commit comments