Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
ecommerce
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
ecommerce
Commits
74e83247
Commit
74e83247
authored
May 06, 2015
by
Clinton Blackburn
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #84 from edx/test-updates
Updated Acceptance Tests
parents
a0f0b829
a773a953
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
19 additions
and
19 deletions
+19
-19
acceptance_tests/config.py
+1
-1
acceptance_tests/mixins.py
+13
-14
acceptance_tests/test_login_enrollment.py
+1
-1
acceptance_tests/test_payment.py
+1
-1
requirements/base.txt
+1
-1
requirements/test.txt
+2
-1
No files found.
acceptance_tests/config.py
View file @
74e83247
...
...
@@ -19,7 +19,7 @@ ECOMMERCE_API_TOKEN = os.environ.get('ECOMMERCE_API_AUTH_TOKEN', ACCESS_TOKEN)
ORDER_PROCESSING_TIME
=
int
(
os
.
environ
.
get
(
'ORDER_PROCESSING_TIME'
,
15
))
# Test configuration
ENABLE_
AUTO_AUTH
=
str2bool
(
os
.
environ
.
get
(
'ENABLE
_AUTO_AUTH'
,
False
))
ENABLE_
LMS_AUTO_AUTH
=
str2bool
(
os
.
environ
.
get
(
'ENABLE_LMS
_AUTO_AUTH'
,
False
))
ENABLE_OAUTH_TESTS
=
str2bool
(
os
.
environ
.
get
(
'ENABLE_OAUTH_TESTS'
,
True
))
COURSE_ID
=
os
.
environ
.
get
(
'COURSE_ID'
,
'edX/DemoX/Demo_Course'
)
VERIFIED_COURSE_ID
=
os
.
environ
.
get
(
'VERIFIED_COURSE_ID'
,
'edX/victor101/Victor_s_test_course'
)
...
...
acceptance_tests/mixins.py
View file @
74e83247
...
...
@@ -2,13 +2,13 @@ import logging
import
uuid
import
requests
from
ecommerce_api_client.client
import
EcommerceApiClient
from
acceptance_tests.api
import
EnrollmentApiClient
from
acceptance_tests.config
import
(
ENABLE_AUTO_AUTH
,
APP_SERVER_URL
,
LMS_PASSWORD
,
LMS_EMAIL
,
LMS_URL
,
from
acceptance_tests.config
import
(
ENABLE_
LMS_
AUTO_AUTH
,
APP_SERVER_URL
,
LMS_PASSWORD
,
LMS_EMAIL
,
LMS_URL
,
BASIC_AUTH_USERNAME
,
BASIC_AUTH_PASSWORD
,
ECOMMERCE_API_SERVER_URL
,
ECOMMERCE_API_SIGNING_KEY
)
LMS_USERNAME
,
ECOMMERCE_API_TOKEN
)
from
acceptance_tests.pages
import
LMSLoginPage
from
ecommerce_api_client.client
import
EcommerceApiClient
log
=
logging
.
getLogger
(
__name__
)
...
...
@@ -20,21 +20,14 @@ class LoginMixin(object):
self
.
lms_login_page
=
LMSLoginPage
(
self
.
browser
)
def
login
(
self
):
if
ENABLE_AUTO_AUTH
:
self
.
login_with_auto_auth
()
else
:
self
.
login_with_lms
()
def
login_with_auto_auth
(
self
):
url
=
'{}/test/auto_auth/'
.
format
(
APP_SERVER_URL
)
self
.
browser
.
get
(
url
)
self
.
login_with_lms
()
def
login_with_lms
(
self
,
email
=
None
,
password
=
None
,
course_id
=
None
):
""" Visit LMS and login. """
email
=
email
or
LMS_EMAIL
password
=
password
or
LMS_PASSWORD
# Note: We use Selenium directly here (as opposed to
Bok C
hoy) to avoid issues with promises being broken.
# Note: We use Selenium directly here (as opposed to
bok-c
hoy) to avoid issues with promises being broken.
self
.
lms_login_page
.
browser
.
get
(
self
.
lms_login_page
.
url
(
course_id
))
# pylint: disable=not-callable
self
.
lms_login_page
.
login
(
email
,
password
)
...
...
@@ -48,6 +41,12 @@ class LogoutMixin(object):
class
LmsUserMixin
(
object
):
password
=
'edx'
def
get_lms_user
(
self
):
if
ENABLE_LMS_AUTO_AUTH
:
return
self
.
create_lms_user
()
return
LMS_USERNAME
,
LMS_PASSWORD
,
LMS_EMAIL
def
create_lms_user
(
self
,
username
=
None
,
password
=
None
,
email
=
None
):
username
=
username
or
(
'auto_auth_'
+
uuid
.
uuid4
()
.
hex
[
0
:
20
])
password
=
password
or
'edx'
...
...
@@ -78,10 +77,10 @@ class EnrollmentApiMixin(object):
class
EcommerceApiMixin
(
object
):
@property
def
ecommerce_api_client
(
self
):
return
EcommerceApiClient
(
ECOMMERCE_API_SERVER_URL
,
ECOMMERCE_API_SIGNING_KEY
,
self
.
username
,
self
.
email
)
return
EcommerceApiClient
(
ECOMMERCE_API_SERVER_URL
,
oauth_access_token
=
ECOMMERCE_API_TOKEN
)
def
assert_order_created_and_completed
(
self
):
orders
=
self
.
ecommerce_api_client
.
get_orders
()
orders
=
self
.
ecommerce_api_client
.
orders
.
get
()[
'results'
]
self
.
assertGreater
(
len
(
orders
),
0
,
'No orders found for the user!'
)
# TODO Validate this is the correct order.
...
...
acceptance_tests/test_login_enrollment.py
View file @
74e83247
...
...
@@ -8,7 +8,7 @@ class LoginEnrollmentTests(EcommerceApiMixin, EnrollmentApiMixin, LmsUserMixin,
def
setUp
(
self
):
super
(
LoginEnrollmentTests
,
self
)
.
setUp
()
self
.
course_id
=
COURSE_ID
self
.
username
,
self
.
password
,
self
.
email
=
self
.
create
_lms_user
()
self
.
username
,
self
.
password
,
self
.
email
=
self
.
get
_lms_user
()
def
test_honor_enrollment_and_login
(
self
):
""" Verifies that a user can login and enroll in a course via the login page. """
...
...
acceptance_tests/test_payment.py
View file @
74e83247
...
...
@@ -14,7 +14,7 @@ class VerifiedCertificatePaymentTests(EcommerceApiMixin, EnrollmentApiMixin, Lms
def
setUp
(
self
):
super
(
VerifiedCertificatePaymentTests
,
self
)
.
setUp
()
self
.
course_id
=
VERIFIED_COURSE_ID
self
.
username
,
self
.
password
,
self
.
email
=
self
.
create
_lms_user
()
self
.
username
,
self
.
password
,
self
.
email
=
self
.
get
_lms_user
()
def
test_payment
(
self
):
self
.
login_with_lms
(
self
.
email
,
self
.
password
)
...
...
requirements/base.txt
View file @
74e83247
...
...
@@ -15,4 +15,4 @@ logutils==0.3.3
pycountry==1.10
requests==2.6.0
git+https://github.com/edx/ecommerce-api-client.git@0.
1.0#egg=ecommerce-api-client
git+https://github.com/edx/ecommerce-api-client.git@0.
4.0#egg=ecommerce-api-client==0.4.0
requirements/test.txt
View file @
74e83247
# Packages required for testing
-r base.txt
bok-choy==0.3.3
git+https://github.com/edx/bok-choy.git@e4e5934b9645e389d14ef22587e8462be4c1cd74#egg=bok_choy
#bok-choy==0.3.3
coverage==3.7.1
ddt==1.0.0
django-nose==1.3
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment