Remove unnecessary files, use generic file for unrelated test.
This commit is contained in:
@@ -5,7 +5,6 @@ End-to-end tests related to the cohort management on the LMS Instructor Dashboar
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
from path import path
|
||||
from pytz import UTC, utc
|
||||
from bok_choy.promise import EmptyPromise
|
||||
from nose.plugins.attrib import attr
|
||||
@@ -71,11 +70,6 @@ class CohortConfigurationTest(EventsTestMixin, UniqueCourseTest, CohortTestMixin
|
||||
self.instructor_dashboard_page.visit()
|
||||
self.cohort_management_page = self.instructor_dashboard_page.select_cohort_management()
|
||||
|
||||
test_dir = path(__file__).abspath().dirname().dirname().dirname().dirname()
|
||||
self.files_path = test_dir + '/data/uploads/'
|
||||
|
||||
test_dir2 = self.instructor_dashboard_page.get_asset_path('.')
|
||||
|
||||
def verify_cohort_description(self, cohort_name, expected_description):
|
||||
"""
|
||||
Selects the cohort with the given name and verifies the expected description is presented.
|
||||
@@ -323,9 +317,14 @@ class CohortConfigurationTest(EventsTestMixin, UniqueCourseTest, CohortTestMixin
|
||||
)
|
||||
|
||||
def _create_csv_file(self, filename, csv_text_as_lists):
|
||||
import csv
|
||||
"""
|
||||
Create a csv file with the provided list of lists.
|
||||
|
||||
:param filename: this is the name that will be used for the csv file. Its location will
|
||||
be under the test upload data directory
|
||||
:param csv_text_as_lists: provide the contents of the csv file int he form of a list of lists
|
||||
"""
|
||||
filename = self.instructor_dashboard_page.get_asset_path(filename)
|
||||
# filename = self.files_path + filename
|
||||
with open(filename, 'w+') as csv_file:
|
||||
writer = csv.writer(csv_file, quoting=csv.QUOTE_ALL)
|
||||
for line in csv_text_as_lists:
|
||||
@@ -494,10 +493,10 @@ class CohortConfigurationTest(EventsTestMixin, UniqueCourseTest, CohortTestMixin
|
||||
And appropriate events have been emitted
|
||||
"""
|
||||
csv_contents = [
|
||||
['username','email','ignored_column','cohort'],
|
||||
[self.instructor_name,'','June','ManualCohort1'],
|
||||
['',self.student_email,'Spring','AutoCohort1'],
|
||||
[self.other_student_name,'','Fall','ManualCohort1'],
|
||||
['username', 'email', 'ignored_column', 'cohort'],
|
||||
[self.instructor_name, '', 'June', 'ManualCohort1'],
|
||||
['', self.student_email, 'Spring', 'AutoCohort1'],
|
||||
[self.other_student_name, '', 'Fall', 'ManualCohort1'],
|
||||
]
|
||||
filename = "cohort_csv_both_columns_1.csv"
|
||||
self._create_csv_file(filename, csv_contents)
|
||||
@@ -536,7 +535,7 @@ class CohortConfigurationTest(EventsTestMixin, UniqueCourseTest, CohortTestMixin
|
||||
"""
|
||||
csv_contents = [
|
||||
['username', 'cohort'],
|
||||
[self.instructor_name,'ManualCohort1'],
|
||||
[self.instructor_name, 'ManualCohort1'],
|
||||
[self.student_name, 'AutoCohort1'],
|
||||
[self.other_student_name, 'ManualCohort1'],
|
||||
]
|
||||
|
||||
@@ -604,7 +604,7 @@ class OwnLearnerProfilePageTest(LearnerProfileTestMixin, WebAppTest):
|
||||
|
||||
self.assert_default_image_has_public_access(profile_page)
|
||||
|
||||
profile_page.upload_file(filename='cohort_users_only_username.csv')
|
||||
profile_page.upload_file(filename='generic_csv.csv')
|
||||
self.assertEqual(
|
||||
profile_page.profile_image_message,
|
||||
"The file must be one of the following types: .gif, .png, .jpeg, .jpg."
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
username,email,ignored_column,cohort
|
||||
instructor_user,,June,ManualCohort1
|
||||
,student_user@example.com,Spring,AutoCohort1
|
||||
other_student_user,,Fall,ManualCohort1
|
||||
|
@@ -1,5 +0,0 @@
|
||||
email,cohort
|
||||
instructor_user@example.com,ManualCohort1
|
||||
student_user@example.com,AutoCohort1
|
||||
other_student_user@example.com,ManualCohort1
|
||||
|
||||
|
@@ -1,4 +0,0 @@
|
||||
username,cohort
|
||||
instructor_user,ManualCohort1
|
||||
student_user,AutoCohort1
|
||||
other_student_user,ManualCohort1
|
||||
|
7
common/test/data/uploads/generic_csv.csv
Normal file
7
common/test/data/uploads/generic_csv.csv
Normal file
@@ -0,0 +1,7 @@
|
||||
column_1,column_2
|
||||
foo,bar
|
||||
foo,baz
|
||||
hello,there
|
||||
file_size,must_be_100_bytes
|
||||
the story,was
|
||||
very very very very very,interesting
|
||||
|
Reference in New Issue
Block a user