Commit af2690fc by Jay Zoldak

Update lettuce test framework to use a course factory instead of the studio UI for creating courses

parent c11d627c
......@@ -27,4 +27,5 @@ Feature: Advanced (manual) course policy
Given I have opened a new course in Studio
When I select the Advanced Settings
And I create a JSON object
Then it is displayed as formatted
\ No newline at end of file
Then it is displayed as formatted
from lettuce import world, step
from factories import *
from lettuce.django import django_url
from nose.tools import assert_true
from nose.tools import assert_equal
import xmodule.modulestore.django
from selenium.webdriver.support.ui import WebDriverWait
from terrain.factories import UserFactory, RegistrationFactory, UserProfileFactory
from terrain.factories import CourseFactory, GroupFactory
import xmodule.modulestore.django
from auth.authz import get_user_by_email
from logging import getLogger
logger = getLogger(__name__)
......@@ -159,9 +162,18 @@ def log_into_studio(
def create_a_course():
css_click('a.new-course-button')
fill_in_course_info()
css_click('input.new-course-save')
c = CourseFactory.create(org='MITx', course='999', display_name='Robot Super Course')
# Add the user to the instructor group of the course
# so they will have the permissions to see it in studio
g = GroupFactory.create(name='instructor_MITx/999/Robot_Super_Course')
u = get_user_by_email('robot+studio@edx.org')
u.groups.add(g)
u.save()
world.browser.reload()
course_link_css = 'span.class-name'
css_click(course_link_css)
course_title_css = 'span.course-title'
assert_true(world.browser.is_element_present_by_css(course_title_css, 5))
......
from student.models import User, UserProfile, Registration
from django.contrib.auth.models import Group
from datetime import datetime
from factory import Factory
from xmodule.modulestore import Location
......@@ -8,6 +9,12 @@ from uuid import uuid4
from xmodule.timeparse import stringify_time
class GroupFactory(Factory):
FACTORY_FOR = Group
name = 'staff_MITx/999/Robot_Super_Course'
class UserProfileFactory(Factory):
FACTORY_FOR = UserProfile
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment