I see what you mean, that makes sense.

But since this value actually depends on a setting, I decided to use this idiom instead:

```
+CMS_BASE_TEST = 'testcms'
+
+    @override_settings(CMS_BASE=CMS_BASE_TEST)
     def test_get_cms_course_link_by_id(self):
```
It's got the same spirit as mock and actually exercises settings.  Whaddya think?

Jason

On Sep 4, 2013, at 10:31 AM, David Baumgold <notifications@github.com> wrote:

> In lms/djangoapps/courseware/tests/test_courses.py:
> 
> > @@ -14,3 +14,11 @@ def test_get_course_by_id_invalid_chars(self):
> >              get_course_by_id('MITx/foobar/statistics=introduction')
> >              get_course_by_id('MITx/foobar/business and management')
> >              get_course_by_id('MITx/foobar/NiñøJoséMaríáßç')
> > +
> > +    def test_get_cms_course_link_by_id(self):
> > +        """
> > +        Tests that get_cms_course_link_by_id returns the right thing
> > +        """
> > +        self.assertEqual("//localhost:8001/", get_cms_course_link_by_id("blah_bad_course_id"))
> > +        self.assertEqual("//localhost:8001/", get_cms_course_link_by_id("too/too/many/slashes"))
> > +        self.assertEqual("//localhost:8001/org/num/course/name", get_cms_course_link_by_id('org/num/name'))
> Not necessarily: I was talking about using the mock testing library in Python. If you're not familiar with how to use it, I can show you how, if you'd like. In this test, you'd want to use the mock.patch decorator to replace the value of host with whatever value you specify for the duration of this test.
> 
> —
> Reply to this email directly or view it on GitHub.
>