<commit_before>#!/usr/bin/env python

__author__ = '<NAME>'

from nose.plugins.attrib import attr

from pyon.core.bootstrap import get_sys_name
from pyon.core.exception import BadRequest
from pyon.datastore.datastore import DataStore
from pyon.public import IonObject, RT
from pyon.util.int_test import IonIntegrationTestCase

from interface.services.coi.idatastore_service import DatastoreServiceClient, DatastoreServiceProcessClient

@attr('INT', group='coi')
class TestDatastore(IonIntegrationTestCase):
    
    def setUp(self):
        # Start container
        self._start_container()
        self.container.start_rel_from_url('res/deploy/r2coi.yml')

        # Now create client to bank service
        self.datastore_service = DatastoreServiceClient(node=self.container.node)

    def test_manage_datastore(self):
        db_name_prefix = get_sys_name().lower()
        self.datastore_service.delete_datastore(db_name_prefix + "_foo")

        self.datastore_service.create_datastore(db_name_prefix + "_foo")

        with self.assertRaises(BadRequest) as cm:
            self.datastore_service.create_datastore(db_name_prefix + "_foo")
        self.assertTrue(cm.exception.message.startswith("Data store with name"))

        ds_list = self.datastore_service.list_datastores()
        self.assertTrue(db_name_prefix + "_foo" in ds_list)

        info = self.datastore_service.info_datastore(db_name_prefix + "_foo")

        self.assertTrue(self.datastore_service.datastore_exists(db_name_prefix + "_foo"))
        self.assertFalse(self.datastore_service.datastore_exists(db_name_prefix + "_bar"))
<commit_msg>Skip datastore service test while service not in r2deploy<commit_after>#!/usr/bin/env python

__author__ = '<NAME>'

from nose.plugins.attrib import attr
import unittest

from pyon.core.bootstrap import get_sys_name
from pyon.core.exception import BadRequest
from pyon.datastore.datastore import DataStore
from pyon.public import IonObject, RT
from pyon.util.int_test import IonIntegrationTestCase

from interface.services.coi.idatastore_service import DatastoreServiceClient, DatastoreServiceProcessClient

@attr('INT', group='coi')
class TestDatastore(IonIntegrationTestCase):
    
    def setUp(self):
        # Start container
        self._start_container()
        self.container.start_rel_from_url('res/deploy/r2coi.yml')

        # Now create client to bank service
        self.datastore_service = DatastoreServiceClient(node=self.container.node)

    @unittest.skip("Datastore service not in r2deploy")
    def test_manage_datastore(self):
        db_name_prefix = get_sys_name().lower()
        self.datastore_service.delete_datastore(db_name_prefix + "_foo")

        self.datastore_service.create_datastore(db_name_prefix + "_foo")

        with self.assertRaises(BadRequest) as cm:
            self.datastore_service.create_datastore(db_name_prefix + "_foo")
        self.assertTrue(cm.exception.message.startswith("Data store with name"))

        ds_list = self.datastore_service.list_datastores()
        self.assertTrue(db_name_prefix + "_foo" in ds_list)

        info = self.datastore_service.info_datastore(db_name_prefix + "_foo")

        self.assertTrue(self.datastore_service.datastore_exists(db_name_prefix + "_foo"))
        self.assertFalse(self.datastore_service.datastore_exists(db_name_prefix + "_bar"))

    @unittest.skip("Datastore service not in r2deploy")
{'fraction_non_alphanumeric': 0.09032258064516129, 'fraction_numerical': 0.001466275659824047, 'mean_word_length': 4.354788069073783, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '4547312', 'n_tokens_mistral': 1092, 'n_tokens_neox': 1067, 'n_words': 186}