<commit_before>"""
    SoftLayer.tests.managers.image_tests
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    :copyright: (c) 2013, SoftLayer Technologies, Inc. All rights reserved.
    :license: MIT, see LICENSE for more details.
"""
from SoftLayer import ImageManager
from SoftLayer.tests import unittest, FixtureClient
from SoftLayer.tests.mocks import (
    Virtual_Guest_Block_Device_Template_Group, Account)

from mock import ANY


class ImageTests(unittest.TestCase):

    def setUp(self):
        self.client = FixtureClient()
        self.image = ImageManager(self.client)
        self.vgbdtg = self.client['Virtual_Guest_Block_Device_Template_Group']
        self.account = self.client['Account']

    def test_get_image(self):
        result = self.image.get_image(100)

        self.vgbdtg.getObject.assert_called_once_with(id=100, mask=ANY)
        self.assertEqual(result,
                         Virtual_Guest_Block_Device_Template_Group.getObject)

    def test_delete_image(self):
        self.image.delete_image(100)

        self.vgbdtg.deleteObject.assert_called_once_with(id=100)

    def test_list_private_images(self):
        results = self.image.list_private_images()

        f = self.account.getPrivateBlockDeviceTemplateGroups
        f.assert_called_once_with(filter={}, mask=ANY)
        self.assertEqual(results, Account.getPrivateBlockDeviceTemplateGroups)

    def test_list_private_images_with_filters(self):
        results = self.image.list_private_images(
            guid='0FA9ECBD-CF7E-4A1F-1E36F8D27C2B', name='name')

        f = self.account.getPrivateBlockDeviceTemplateGroups
        f.assert_called_once_with(
            filter={
                'privateBlockDeviceTemplateGroups': {
                    'globalIdentifier': {
                        'operation': '_= 0FA9ECBD-CF7E-4A1F-1E36F8D27C2B'},
                    'name': {'operation': '_= name'}}},
            mask=ANY)
        self.assertEqual(results, Account.getPrivateBlockDeviceTemplateGroups)

    def test_list_public_images(self):
        results = self.image.list_public_images()

        self.vgbdtg.getPublicImages.assert_called_once_with(filter={},
                                                            mask=ANY)
        self.assertEqual(
            results, Virtual_Guest_Block_Device_Template_Group.getPublicImages)

    def test_list_public_images_with_filters(self):
        results = self.image.list_public_images(
            guid='0FA9ECBD-CF7E-4A1F-1E36F8D27C2B', name='name')

        self.vgbdtg.getPublicImages.assert_called_once_with(
            filter={
                'globalIdentifier': {
                    'operation': '_= 0FA9ECBD-CF7E-4A1F-1E36F8D27C2B'},
                'name': {'operation': '_= name'}},
            mask=ANY)
        self.assertEqual(
            results, Virtual_Guest_Block_Device_Template_Group.getPublicImages)

    # self.resolvers = [self._get_ids_from_guid_public,
    #                   self._get_ids_from_guid_private,
    #                   self._get_ids_from_name_public,
    #                   self._get_ids_from_name_private]
    # public guid: '3C1F3C68-0B67-4F5E-8907-D0FC84BF3F12'
    # private guid: '3C1F3C68-0B67-4F5E-8907-D0FC84BF3F12'
    # public name: 'image_name' => []
    # private name: 'private_image_name' => []
    # unknown: 'unknown_name' => []
    def test_resolve_ids_guid_public(self):
        self.vgbdtg.getPublicImages.return_value = [{'id': 100}]
        self.account.getPrivateBlockDeviceTemplateGroups.return_value = []
        result = self.image.resolve_ids('3C1F3C68-0B67-4F5E-8907-D0FC84BF3F12')

        self.assertEquals([100], result)

    def test_resolve_ids_guid_private(self):
        self.vgbdtg.getPublicImages.return_value = []
        self.account.getPrivateBlockDeviceTemplateGroups.return_value = \
            [{'id': 100}]<commit_msg>Removes notes<commit_after>"""
    SoftLayer.tests.managers.image_tests
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    :copyright: (c) 2013, SoftLayer Technologies, Inc. All rights reserved.
    :license: MIT, see LICENSE for more details.
"""
from SoftLayer import ImageManager
from SoftLayer.tests import unittest, FixtureClient
from SoftLayer.tests.mocks import (
    Virtual_Guest_Block_Device_Template_Group, Account)

from mock import ANY


class ImageTests(unittest.TestCase):

    def setUp(self):
        self.client = FixtureClient()
        self.image = ImageManager(self.client)
        self.vgbdtg = self.client['Virtual_Guest_Block_Device_Template_Group']
        self.account = self.client['Account']

    def test_get_image(self):
        result = self.image.get_image(100)

        self.vgbdtg.getObject.assert_called_once_with(id=100, mask=ANY)
        self.assertEqual(result,
                         Virtual_Guest_Block_Device_Template_Group.getObject)

    def test_delete_image(self):
        self.image.delete_image(100)

        self.vgbdtg.deleteObject.assert_called_once_with(id=100)

    def test_list_private_images(self):
        results = self.image.list_private_images()

        f = self.account.getPrivateBlockDeviceTemplateGroups
        f.assert_called_once_with(filter={}, mask=ANY)
        self.assertEqual(results, Account.getPrivateBlockDeviceTemplateGroups)

    def test_list_private_images_with_filters(self):
        results = self.image.list_private_images(
            guid='0FA9ECBD-CF7E-4A1F-1E36F8D27C2B', name='name')

        f = self.account.getPrivateBlockDeviceTemplateGroups
        f.assert_called_once_with(
            filter={
                'privateBlockDeviceTemplateGroups': {
                    'globalIdentifier': {
                        'operation': '_= 0FA9ECBD-CF7E-4A1F-1E36F8D27C2B'},
                    'name': {'operation': '_= name'}}},
            mask=ANY)
        self.assertEqual(results, Account.getPrivateBlockDeviceTemplateGroups)

    def test_list_public_images(self):
        results = self.image.list_public_images()

        self.vgbdtg.getPublicImages.assert_called_once_with(filter={},
                                                            mask=ANY)
        self.assertEqual(
            results, Virtual_Guest_Block_Device_Template_Group.getPublicImages)

    def test_list_public_images_with_filters(self):
        results = self.image.list_public_images(
            guid='0FA9ECBD-CF7E-4A1F-1E36F8D27C2B', name='name')

        self.vgbdtg.getPublicImages.assert_called_once_with(
            filter={
                'globalIdentifier': {
                    'operation': '_= 0FA9ECBD-CF7E-4A1F-1E36F8D27C2B'},
                'name': {'operation': '_= name'}},
            mask=ANY)
        self.assertEqual(
            results, Virtual_Guest_Block_Device_Template_Group.getPublicImages)

    def test_resolve_ids_guid_public(self):
        self.vgbdtg.getPublicImages.return_value = [{'id': 100}]
        self.account.getPrivateBlockDeviceTemplateGroups.return_value = []
        result = self.image.resolve_ids('3C1F3C68-0B67-4F5E-8907-D0FC84BF3F12')

        self.assertEquals([100], result)

    def test_resolve_ids_guid_private(self):
        self.vgbdtg.getPublicImages.return_value = []
        self.account.getPrivateBlockDeviceTemplateGroups.return_value = \
            [{'id': 100}]
{'fraction_non_alphanumeric': 0.10677872692201708, 'fraction_numerical': 0.031138054560484983, 'mean_word_length': 2.808499475341028, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5202356', 'n_tokens_mistral': 2342, 'n_tokens_neox': 2184, 'n_words': 285}