<commit_before># -*- coding: UTF-8 -*-
from test.source.shotgun.base import ShotgunTestCase

from zou.app.models.project import Project


class ImportShotgunShotTestCase(ShotgunTestCase):

    def setUp(self):
        super(ImportShotgunShotTestCase, self).setUp()

    def test_import_assets(self):
        self.load_fixture('projects')
        self.entities = self.load_fixture('assets')
        self.assertEqual(len(self.entities), 2)

        self.entities = self.get("data/entities")
        self.assertEqual(len(self.entities), 2)

    def test_import_twice_assets(self):
        self.load_fixture('projects')
        self.entities = self.load_fixture('assets')
        self.entities = self.load_fixture('assets')
        self.assertEqual(len(self.entities), 2)

        self.entities = self.get("data/entities")
        self.assertEqual(len(self.entities), 2)

    def test_import_asset(self):
        self.load_fixture('projects')
        sg_asset = {
            "code": "Cake",
            "description": "yellow cake",
            "project": {
                "type": "Project",
                "id": 1,
                "name": "Cosmos Landromat"
            },
            "sg_asset_type": "Props",
            "type": "Asset",
            "id": 3
        }

        api_path = "data/import/shotgun/assets"
        self.assets = self.post(api_path, [sg_asset], 200)
        self.assertEqual(len(self.assets), 1)

        self.assets = self.get("data/entities")
        self.assertEqual(len(self.assets), 1)

        asset = self.assets[0]
        print(sg_asset["project"]["name"])
        project = Project.get_by(shotgun_id=sg_asset["project"]["id"])
        self.assertEqual(asset["description"], sg_asset["description"])
        self.assertEqual(asset["shotgun_id"], sg_asset["id"])
        self.assertEqual(asset["project_id"], str(project.id))<commit_msg>Remove debug print form SG import assets test<commit_after># -*- coding: UTF-8 -*-
from test.source.shotgun.base import ShotgunTestCase

from zou.app.models.project import Project


class ImportShotgunShotTestCase(ShotgunTestCase):

    def setUp(self):
        super(ImportShotgunShotTestCase, self).setUp()

    def test_import_assets(self):
        self.load_fixture('projects')
        self.entities = self.load_fixture('assets')
        self.assertEqual(len(self.entities), 2)

        self.entities = self.get("data/entities")
        self.assertEqual(len(self.entities), 2)

    def test_import_twice_assets(self):
        self.load_fixture('projects')
        self.entities = self.load_fixture('assets')
        self.entities = self.load_fixture('assets')
        self.assertEqual(len(self.entities), 2)

        self.entities = self.get("data/entities")
        self.assertEqual(len(self.entities), 2)

    def test_import_asset(self):
        self.load_fixture('projects')
        sg_asset = {
            "code": "Cake",
            "description": "yellow cake",
            "project": {
                "type": "Project",
                "id": 1,
                "name": "<NAME>"
            },
            "sg_asset_type": "Props",
            "type": "Asset",
            "id": 3
        }

        api_path = "data/import/shotgun/assets"
        self.assets = self.post(api_path, [sg_asset], 200)
        self.assertEqual(len(self.assets), 1)

        self.assets = self.get("data/entities")
        self.assertEqual(len(self.assets), 1)

        asset = self.assets[0]
        project = Project.get_by(shotgun_id=sg_asset["project"]["id"])
        self.assertEqual(asset["description"], sg_asset["description"])
        self.assertEqual(asset["shotgun_id"], sg_asset["id"])
        self.assertEqual(asset["project_id"], str(project.id))
{'fraction_non_alphanumeric': 0.14228187919463087, 'fraction_numerical': 0.00697986577181208, 'mean_word_length': 2.5621414913957934, 'pattern_counts': {'":': 18, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6074250', 'n_tokens_mistral': 1152, 'n_tokens_neox': 1119, 'n_words': 178}