<commit_before>import os
import unittest
import subprocess

from tests.temp_mixin import TempMixin


class TestRemoteAppDbCLI(TempMixin, unittest.TestCase):
    def setUp(self):
        super().setUp()
        self.db = os.path.join(self.tempdir, "test.db")
        subprocess.check_output(
            ("remoteappdb --db="+self.db+" init").split()
        )

    def _remoteappdb(self, argstring):
        return subprocess.check_output(
            ("remoteappdb --db="+self.db+" "+argstring).split()
        ).decode("utf-8")

    def test_init_command(self):
        self.assertTrue(os.path.exists(self.db))

    def test_user_create(self):
        out = self._remoteappdb("user create foo")
        self.assertEqual(out, "1\n")

        out = self._remoteappdb("user create bar")
        self.assertEqual(out, "2\n")

        out = self._remoteappdb("user list")

        self.assertIn("foo", out)
        self.assertIn("bar", out)

    def test_team_create(self):
        out = self._remoteappdb("team create foo")
        self.assertEqual(out, "1\n")
        out = self._remoteappdb("team create bar")
        self.assertEqual(out, "2\n")

        out = self._remoteappdb("team list")

        self.assertIn("foo", out)
        self.assertIn("bar", out)

    def test_user_has_team(self):
        self._remoteappdb("user create foo")
        out = self._remoteappdb("team list")

        self.assertIn("foo", out)

    def test_app_create(self):
        out = self._remoteappdb("app create myapp")
        self.assertEqual(out, "1\n")

        out = self._remoteappdb("app list")
        self.assertIn("myapp", out)

    def test_app_expose(self):
        self._remoteappdb("app create myapp")
        self._remoteappdb("user create user")

        out = self._remoteappdb("user list")
        self.assertNotIn("myapp", out)
        self._remoteappdb("app expose myapp user")
        out = self._remoteappdb("user list")
        self.assertIn("myapp", out)<commit_msg>Removed tests for team in the CLI program<commit_after>import os
import unittest
import subprocess

from tests.temp_mixin import TempMixin


class TestRemoteAppDbCLI(TempMixin, unittest.TestCase):
    def setUp(self):
        super().setUp()
        self.db = os.path.join(self.tempdir, "test.db")
        subprocess.check_output(
            ("remoteappdb --db="+self.db+" init").split()
        )

    def _remoteappdb(self, argstring):
        return subprocess.check_output(
            ("remoteappdb --db="+self.db+" "+argstring).split()
        ).decode("utf-8")

    def test_init_command(self):
        self.assertTrue(os.path.exists(self.db))

    def test_user_create(self):
        out = self._remoteappdb("user create foo")
        self.assertEqual(out, "1\n")

        out = self._remoteappdb("user create bar")
        self.assertEqual(out, "2\n")

        out = self._remoteappdb("user list")

        self.assertIn("foo", out)
        self.assertIn("bar", out)

    def test_app_create(self):
        out = self._remoteappdb("app create myapp")
        self.assertEqual(out, "1\n")

        out = self._remoteappdb("app list")
        self.assertIn("myapp", out)

    def test_app_expose(self):
        self._remoteappdb("app create myapp")
        self._remoteappdb("user create user")

        out = self._remoteappdb("user list")
        self.assertNotIn("myapp", out)
        self._remoteappdb("app expose myapp user")
        out = self._remoteappdb("user list")
        self.assertIn("myapp", out)
{'fraction_non_alphanumeric': 0.1353749284487693, 'fraction_numerical': 0.0028620492272467086, 'mean_word_length': 2.6482254697286014, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6693545', 'n_tokens_mistral': 1106, 'n_tokens_neox': 1082, 'n_words': 219}