def test_copy_diff_composition_version_from_composition_version(self):
     diff_composition_version = DiffCompositionVersion.copy_from_version(
         self.composition_version
     )
     self.assertEquals(diff_composition_version.tracks.count(), self.tracks_count)
     self.assertEquals(
         diff_composition_version.tracks.count(),
         self.composition_version.tracks.count()
     )
 def sign_in(self, request, data, *args, **kwargs):
     serializer = IsAuthenticatedSerializer(data=data)
     serializer.is_valid(raise_exception=True)
     composition_id = kwargs.get("composition_id")
     user = self.check_composition_perms(serializer, composition_id)
     if user is not None:
         request.channel_session["user"] = user.id
         Group(self.COMPOSITION_GROUP_TEMPLATE % composition_id).add(request.reply_channel)
         composition = Composition.objects.get(id=composition_id)
         diff_version = composition.diff_versions.last()
         if diff_version is None:
             composition_version = composition.versions.order_by("create_datetime").last()
             diff_version = DiffCompositionVersion.copy_from_version(composition_version)
         self.route_send(request.reply_channel, DiffCompositionVersionSerializer(diff_version).data)
     else:
         raise PermissionDenied