def test_minimal(self): project = self.create_project() version = "bbee5b51f84611e4b14834363b8514c2" data_list = [ { "id": "c7155651831549cf8a5e47889fce17eb", "message": "foo", "author_email": "*****@*****.**", }, {"id": "bbee5b51f84611e4b14834363b8514c2", "message": "bar", "author_name": "Joe^^"}, ] hook = ReleaseHook(project) hook.set_commits(version, data_list) release = Release.objects.get(projects=project, version=version) commit_list = list( Commit.objects.filter(releasecommit__release=release) .select_related("author") .order_by("releasecommit__order") ) assert len(commit_list) == 2 assert commit_list[0].key == "c7155651831549cf8a5e47889fce17eb" assert commit_list[0].message == "foo" assert commit_list[0].author.name is None assert commit_list[0].author.email == "*****@*****.**" assert commit_list[1].key == "bbee5b51f84611e4b14834363b8514c2" assert commit_list[1].message == "bar" assert commit_list[1].author.name == "Joe^^" assert commit_list[1].author.email == "joe@localhost"
def test_bad_version(self): project = self.create_project() hook = ReleaseHook(project) version = '' with self.assertRaises(HookValidationError): hook.start_release(version) with self.assertRaises(HookValidationError): hook.finish_release(version) with self.assertRaises(HookValidationError): hook.set_commits(version, []) version = '.' with self.assertRaises(HookValidationError): hook.start_release(version) with self.assertRaises(HookValidationError): hook.finish_release(version) with self.assertRaises(HookValidationError): hook.set_commits(version, []) version = '..' with self.assertRaises(HookValidationError): hook.start_release(version) with self.assertRaises(HookValidationError): hook.finish_release(version) with self.assertRaises(HookValidationError): hook.set_commits(version, [])
def test_minimal(self): project = self.create_project() version = 'bbee5b51f84611e4b14834363b8514c2' data_list = [ { 'id': 'c7155651831549cf8a5e47889fce17eb', 'message': 'foo', 'author_email': '*****@*****.**', }, { 'id': 'bbee5b51f84611e4b14834363b8514c2', 'message': 'bar', 'author_name': 'Joe^^', }, ] hook = ReleaseHook(project) hook.set_commits(version, data_list) release = Release.objects.get( projects=project, version=version, ) commit_list = list( Commit.objects.filter( releasecommit__release=release, ).select_related( 'author', ).order_by('releasecommit__order') ) assert len(commit_list) == 2 assert commit_list[0].key == 'c7155651831549cf8a5e47889fce17eb' assert commit_list[0].message == 'foo' assert commit_list[0].author.name is None assert commit_list[0].author.email == '*****@*****.**' assert commit_list[1].key == 'bbee5b51f84611e4b14834363b8514c2' assert commit_list[1].message == 'bar' assert commit_list[1].author.name == 'Joe^^' assert commit_list[1].author.email == 'joe@localhost'
def test_bad_version(self): project = self.create_project() hook = ReleaseHook(project) version = '' with self.assertRaises(HookValidationError): hook.start_release(version) with self.assertRaises(HookValidationError): hook.finish_release(version) with self.assertRaises(HookValidationError): hook.set_commits(version, []) version = '.' with self.assertRaises(HookValidationError): hook.start_release(version) with self.assertRaises(HookValidationError): hook.finish_release(version) with self.assertRaises(HookValidationError): hook.set_commits(version, []) version = '..' with self.assertRaises(HookValidationError): hook.start_release(version) with self.assertRaises(HookValidationError): hook.finish_release(version) with self.assertRaises(HookValidationError): hook.set_commits(version, [])
def test_minimal(self): project = self.create_project() version = 'bbee5b51f84611e4b14834363b8514c2' data_list = [ { 'id': 'c7155651831549cf8a5e47889fce17eb', 'message': 'foo', 'author_email': '*****@*****.**', }, { 'id': 'bbee5b51f84611e4b14834363b8514c2', 'message': 'bar', 'author_name': 'Joe^^', }, ] hook = ReleaseHook(project) hook.set_commits(version, data_list) release = Release.objects.get( projects=project, version=version, ) commit_list = list( Commit.objects.filter( releasecommit__release=release, ).select_related( 'author', ).order_by('releasecommit__order')) assert len(commit_list) == 2 assert commit_list[0].key == 'c7155651831549cf8a5e47889fce17eb' assert commit_list[0].message == 'foo' assert commit_list[0].author.name is None assert commit_list[0].author.email == '*****@*****.**' assert commit_list[1].key == 'bbee5b51f84611e4b14834363b8514c2' assert commit_list[1].message == 'bar' assert commit_list[1].author.name == 'Joe^^' assert commit_list[1].author.email == 'joe@localhost'