A simplified way of organizing all information and materials for a course
Note: this was for a school project. Since that work has long-since been submitted, we've now archived the repository to make it clear we do not intend to maintain this code going forward. Fork this project with caution, as there are probably bugs and security issues in the project's dependency tree.
This will allow you to easily pre-make a sample course and test it.
If you want to test our course creation UI, please see the selection below.
Please follow our system-specific setup steps first:
Before running the project, make sure you enter in your Piazza credentials in a
new file named backend/sample_user.txt
following the two-line format:
myemail@domain.com
mypassword
If you're enrolled in UCLA's Fall 2015 CS 130 with that info, you're good to go and should have no issues displaying piazza information on the web UI.
At this point, you can visit 127.0.0.1:5000/ to see a running page of our project. Click on the link for CS 130 to be taken to the course page. If that's good enough for you, then you're done at this point, and can skip the steps below.
To test this out, follow the same steps as in the above section, but do not run
./addSampleData.py
. Open up the web browser to
http://localhost:5000/
From there, fill out the course creation UI as you see fit (adding in weeks, assignments, and resources). We don't support leaving any elements on the page as empty, so if you want to not add something (i.e. you want to create a course with no assignments initially), click the "minus" sign.
Running backend unit tests is fairly simple. Below are the steps for Linux:
In one terminal, start the backend server by running:
$ cd backend/
$ ./setup.sh
In a second terminal execute the tests by running:
$ cd backend/
$ python testCRUD.py # all tests should pass
This should run all backend unit tests on CRUD operations (Create, read, update,
delete). All tests are also run by Travis CI (continuous integration) upon each
push and each pull request, so you can also check the build status at the top of
this README. If you're running on Windows, replace setup.sh
with setup.bat
,
and you should be able to get the tests running as well.
We've recently added mocha unit tests for frontend code! To get these running, please follow the below steps (again, these are for Ubuntu, but similar steps should work for any system).
-
Look at the "Installation for Development" section for steps on installing NodeJS
-
Make sure NodeJS is updated to v5 (we've noticed that some of our tests will timeout with older versions of Node) - If you're having trouble getting node updated, I found some success using the Node Version Manager and then running
nvm install 5.0
from within thefrontend/
directory (see our Travis CI config for details on how we got this to work. - Runnode --version
and make sure you seev5.0.0
as the output. Do not proceed if your output differs significantly. -
Then run the following code to install all dependencies:
$ cd backend/frontend/ # unless you're already there $ npm install $ npm list --depth=0 # should return with status 0
-
If
npm list --depth=0
succeeds, continue on to step 5. Otherwise, please manually install the dependencies it lists as missing:$ npm install babel-runtime@^5.8.25 # for example, if this dep is missing
-
If
npm list --depth=0
now succeeds, you can run the actual tests withnpm test
.
We've written out UI tests using the Selenium framework. To use these please follow these steps:
-
Look at the "Installation for Development" section for steps on installing NodeJS
-
Make sure NodeJS is updated to v5 (Look above for more details on this)
-
Run the following commands in your first terminal:
$ cd backend/ $ ./setup.sh
-
In your second terminal, run the following commands:
$ cd backend/ $ ./addSampleData.py $ cd frontend/ $ npm install $ npm list --depth=0 # make sure this succeeds $ npm install mocha -g $ mocha selenium-test.js --compilers js:babel-core/register --timeout 10000
To install gulp for frontend work, you'll need to run:
$ cd course-dashboard/backend/frontend
$ sudo apt-get install npm
$ sudo npm install gulp -g
$ npm install
$ # or do similar commands for your system
To install gulp for frontend work:
-
Install Node - Download the MSI for your appropriate OS here
-
Execute the following commands to install npm and gulp
> cd course-dashboard/backend/frontend > npm install gulp -g > npm install
If you want to interact directly with our backend (and bypass the web interface), you can do so via python.
In your first terminal, launch the backend as done previously (with
./setup.sh
). Then in another terminal, you can launch python to interact with
the database through the API calls:
>>> # In a python REPL
>>> from requests import post, get
>>> post('http://127.0.0.1:5000/0/course/add/').json()
>>> # output should be: {u'message': u'New course was successfully initialized', u'course_id': '1'}
>>> post('http://127.0.0.1:5000/1/node/add/', data={'contents': 'foo', 'renderer': 'bar'}).json()
>>> # We use a '/1/node/add/' here because '1' is the course ID of the course we just created
>>> # output should be: {u'message': u'New node was successfully created'}
>>> # more commands here...
>>> # see rpc_specification.md for details on commands
>>> exit()
Now that this course has ended, we can officially accept contributions from the open source community! If you like our project and want to contribute, feel free to open a pull request and one of us will review it.