-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtestcases_playlists.py
85 lines (73 loc) · 3.34 KB
/
testcases_playlists.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#=======================================================================
#
# PLAYLIST TESTS
#
#=======================================================================
#
# Includes the following test cases:
# 1. TestCase_DisablePlaylists_550
# 2. TestCase_EnablePlaylistsForAdmins_551
# 2. TestCase_EnablePlaylistsForEveryone_552
from selenium import selenium
import imaplib
import unittest, os, time, re, mclib, testcase_base
import loginlogout, sitesettings, testvars, categories, submitvideos, queue, videopage, playlists
import sys
# ----------------------------------------------------------------------
class TestCase_DisablePlaylists_550(testcase_base.testcase_BaseTestCase):
def test_DisablePlaylists(self):
sel = self.selenium
# Log in as Admin
loginlogout.LogInAsAdmin(self,sel)
print "Starting test..."
sitesettings.EnablePlaylists(self,sel,"No")
print "Going to check if Playlists page is available..."
print "=== For ADMIN:"
playlists.VerifyPlaylistsPageIsDisabled(self,sel)
print "=== For USER:"
loginlogout.LogOut(self,sel)
loginlogout.LogInAsUser(self,sel)
playlists.VerifyPlaylistsPageIsDisabled(self,sel)
print "=== For ANONYMOUS USER:"
loginlogout.LogOut(self,sel)
playlists.VerifyPlaylistsPageIsDisabled(self,sel)
class TestCase_EnablePlaylistsForAdmins_551(testcase_base.testcase_BaseTestCase):
def test_EnablePlaylistsForAdmins(self):
sel = self.selenium
# Log in as Admin
loginlogout.LogInAsAdmin(self,sel)
print "Starting test..."
sitesettings.EnablePlaylists(self,sel,"Admins Only")
print "Going to check if Playlists page is available..."
print "=== For ADMIN:"
playlists.VerifyPlaylistsPageIsEnabled(self,sel)
print "=== For USER:"
loginlogout.LogOut(self,sel)
loginlogout.LogInAsUser(self,sel)
playlists.VerifyPlaylistsPageIsDisabled(self,sel)
print "=== For ANONYMOUS USER:"
loginlogout.LogOut(self,sel)
playlists.VerifyPlaylistsPageIsDisabled(self,sel)
class TestCase_EnablePlaylistsForEveryone_552(testcase_base.testcase_BaseTestCase):
def test_EnablePlaylistsForEveryone(self):
sel = self.selenium
# Log in as Admin
loginlogout.LogInAsAdmin(self,sel)
print "Starting test..."
sitesettings.EnablePlaylists(self,sel,"Yes")
print "Going to check if Playlists page is available..."
print "=== For ADMIN:"
playlists.VerifyPlaylistsPageIsEnabled(self,sel)
print "=== For USER:"
loginlogout.LogOut(self,sel)
loginlogout.LogInAsUser(self,sel)
playlists.VerifyPlaylistsPageIsEnabled(self,sel)
print "=== For ANONYMOUS USER:"
loginlogout.LogOut(self,sel)
sel.open(testvars.MCTestVariables["PlaylistsPage"])
sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
if sel.is_text_present("Login/Sign Up")==False:
mclib.AppendErrorMessage(self,sel,"Anonymous user is not required to log in")
print sel.get_html_source()
else:
print "OK - anonymous user is prompted to log in to view the playlist, test passed"