def test_student_view_data_disable_player_token(): """ Test the student_view_data() results when enable_player_token=False. """ field_data_dict = dict( partner_code='PARTNER-CODE', content_id='CONTENT-ID', ) expected_data = dict(player_token="", player_token_expires=None, **field_data_dict) field_data = DictFieldData( dict(enable_player_token=False, **field_data_dict)) player = OoyalaPlayerBlock(runtime, field_data, None) student_view_data = player.student_view_data() assert_equal(student_view_data, expected_data)
def test_student_view_data_enable_player_token(mock_generate_player_token): """ Test the student_view_data() results when enable_player_token=True. """ field_data_dict = dict( partner_code='PARTNER-CODE', content_id='CONTENT-ID', ) expected_data = dict(player_token="http://player_token.url", player_token_expires=12345, **field_data_dict) field_data = DictFieldData( dict(enable_player_token=True, **field_data_dict)) player = OoyalaPlayerBlock(runtime, field_data, None) student_view_data = player.student_view_data() mock_generate_player_token.assert_called_once() assert_equal(student_view_data, expected_data)
def test_student_view_data_disable_player_token(): """ Test the student_view_data() results when enable_player_token=False. """ field_data_dict = dict( partner_code='PARTNER-CODE', content_id='CONTENT-ID', ) expected_data = dict( player_token="", player_token_expires=None, **field_data_dict ) field_data = DictFieldData(dict(enable_player_token=False, **field_data_dict)) player = OoyalaPlayerBlock(runtime, field_data, None) student_view_data = player.student_view_data() assert_equal(student_view_data, expected_data)
def test_student_view_data_enable_player_token(mock_generate_player_token): """ Test the student_view_data() results when enable_player_token=True. """ field_data_dict = dict( partner_code='PARTNER-CODE', content_id='CONTENT-ID', ) expected_data = dict( player_token="http://player_token.url", player_token_expires=12345, **field_data_dict ) field_data = DictFieldData(dict(enable_player_token=True, **field_data_dict)) player = OoyalaPlayerBlock(runtime, field_data, None) student_view_data = player.student_view_data() mock_generate_player_token.assert_called_once() assert_equal(student_view_data, expected_data)