# Path: edx2canvas/models.py
# class CanvasApiAuthorization(models.Model):
#     lti_user_id = models.CharField(max_length=255, unique=True, db_index=True)
#     canvas_api_token = models.CharField(max_length=255)
# 
#     def __unicode__(self):
#         return "user: {}, token: {}".format(self.lti_user_id, self.canvas_api_token)
# 
# class EdxCourse(models.Model):
#     title = models.CharField(max_length=255)
#     org = models.CharField(max_length=128)
#     course = models.CharField(max_length=32)
#     run = models.CharField(max_length=32)
#     key_version = models.IntegerField()
# 
#     def course_key(self):
#         if self.key_version == 0:
#             return "{}/{}/{}".format(self.org, self.course, self.run)
#         if self.key_version == 1:
#             return "course-v1:{}+{}+{}".format(self.org, self.course, self.run)
#         raise NotImplementedError()


from django.conf import settings
from unittest import TestCase
from mock import patch, MagicMock
from edx2canvas.models import CanvasApiAuthorization, EdxCourse

class TestBase(TestCase):

    def setUp(self):
        super(TestBase, self).setUp()
        self.edx_course_id = 42
        self.edx_course = EdxCourse(
            title='EdX Course Title',
            org='edX_course_org',
            course='edX_course_course',
            run='edX_course_run',
            key_version=1
        )
        self.edx_course_key = self.edx_course.course_key()
        self.edx_usage_id = 'edx_content_usage_id'
        self.content_title = 'content item title'
        self.edx_url_base = 'https://edx.example.com'
        settings.EDX_URL_BASE = self.edx_url_base

        self.canvas_course_id = 256
        self.canvas_module_id = 123
        self.canvas_user_id = 'value of the LTI user_id field'
        self.canvas_api_token = 'Token to access the Canvas API'

# Path: edx2canvas/models.py
# class CanvasApiAuthorization(models.Model):
#     lti_user_id = models.CharField(max_length=255, unique=True, db_index=True)
#     canvas_api_token = models.CharField(max_length=255)
# 
#     def __unicode__(self):
#         return "user: {}, token: {}".format(self.lti_user_id, self.canvas_api_token)
# 
# class EdxCourse(models.Model):
#     title = models.CharField(max_length=255)
#     org = models.CharField(max_length=128)
#     course = models.CharField(max_length=32)
#     run = models.CharField(max_length=32)
#     key_version = models.IntegerField()
# 
#     def course_key(self):
#         if self.key_version == 0:
#             return "{}/{}/{}".format(self.org, self.course, self.run)
#         if self.key_version == 1:
#             return "course-v1:{}+{}+{}".format(self.org, self.course, self.run)
#         raise NotImplementedError()


# Path: edx2canvas/tests/test_common.py
from django.conf import settings
from unittest import TestCase
from mock import patch, MagicMock
from edx2canvas.models import CanvasApiAuthorization, EdxCourse


class TestBase(TestCase):

    def setUp(self):
        super(TestBase, self).setUp()
        self.edx_course_id = 42
        self.edx_course = EdxCourse(
            title='EdX Course Title',
            org='edX_course_org',
            course='edX_course_course',
            run='edX_course_run',
            key_version=1
        )
        self.edx_course_key = self.edx_course.course_key()
        self.edx_usage_id = 'edx_content_usage_id'
        self.content_title = 'content item title'
        self.edx_url_base = 'https://edx.example.com'
        settings.EDX_URL_BASE = self.edx_url_base

        self.canvas_course_id = 256
        self.canvas_module_id = 123
        self.canvas_user_id = 'value of the LTI user_id field'
        self.canvas_api_token = 'Token to access the Canvas API'

        self.canvas_api_authorization = CanvasApiAuthorization(