def test_playbook_serializer_compress_arguments(self): serializer = serializers.PlaybookSerializer( data={"ansible_version": "2.4.0", "path": "/path/playbook.yml", "arguments": factories.PLAYBOOK_ARGUMENTS} ) serializer.is_valid() playbook = serializer.save() playbook.refresh_from_db() self.assertEqual(playbook.arguments, utils.compressed_obj(factories.PLAYBOOK_ARGUMENTS))
def test_playbook_serializer(self): serializer = serializers.PlaybookSerializer( data={"name": "serializer-playbook", "ansible_version": "2.4.0", "path": "/path/playbook.yml"} ) serializer.is_valid() playbook = serializer.save() playbook.refresh_from_db() self.assertEqual(playbook.name, "serializer-playbook") self.assertEqual(playbook.ansible_version, "2.4.0") self.assertEqual(playbook.status, "unknown")
def test_playbook_serializer_decompress_arguments(self): playbook = factories.PlaybookFactory(arguments=utils.compressed_obj(factories.PLAYBOOK_ARGUMENTS)) serializer = serializers.PlaybookSerializer(instance=playbook) self.assertEqual(serializer.data["arguments"], factories.PLAYBOOK_ARGUMENTS)