def test_custom_license_text(self): repo = ContentRepository( license=CUSTOM_REPO_LICENSE_TYPE, custom_license_name='Foo', custom_license_text='Bar') repo.save() self.assertEqual(repo.get_license_text(), 'Bar') self.assertEqual(unicode(repo), 'Foo (Custom license)')
def test_write_license_file(self): with self.settings(GIT_REPO_PATH=self.workspace.working_dir): repo = ContentRepository(license='CC-BY-4.0') repo.save() file_path = os.path.join(settings.GIT_REPO_PATH, 'LICENSE') with open(file_path, 'r') as fp: license_text = fp.read() self.assertEqual(license_text, repo.get_license_text())