Example #1
0
    def test_start_with_project_argument_with_no_project_available(
            self) -> None:
        """ Test the output of the timer start function with the `-p` argument when there is no project available. 

        This command output should print out a warning to the user about there not being any project in the account 
            but still start a timer.
        """
        out1 = self._run_command('tgl start "This is a test timer" -p')

        self.assertIn("WARNING: You don't have any projects in your account.",
                      out1)
        self.assertIn(
            "If you created one recently, please run 'tgl reconfig' to reconfigure your data.",
            out1)
        self.assertIn("Timer will be crated without project.", out1)
        self.assertIn("Timer started.", out1)

        tgl_stop()

        out2 = self._run_command('tgl start "This is a test timer" --project')

        self.assertIn("WARNING: You don't have any projects in your account.",
                      out2)
        self.assertIn(
            "If you created one recently, please run 'tgl reconfig' to reconfigure your data.",
            out2)
        self.assertIn("Timer will be crated without project.", out2)
        self.assertIn("Timer started.", out2)
Example #2
0
    def test_start_with_multiple_one_word_tags(self) -> None:
        """ Test that the `tgl start [-t/--tags]` commands works with a multiple one-word tags. """
        out1 = self._run_command('tgl start "description" -t tag3 tag4')
        self.assertIn('Timer started.', out1)
        tgl_stop()

        out2 = self._run_command('tgl start "description" --tags tag3 tag4')
        self.assertIn('Timer started.', out2)
Example #3
0
    def test_start_with_one_multiword_tag(self) -> None:
        """ Test that the `tgl start [-t/--tags]` commands works with a single multiword tag. """
        out1 = self._run_command(
            'tgl start "description" -t "tag 1 with spaces"')
        self.assertIn('Timer started.', out1)
        tgl_stop()

        out2 = self._run_command(
            'tgl start "description" --tags "tag 2 with spaces"')
        self.assertIn('Timer started.', out2)
Example #4
0
    def test_start_with_workspace_argument_with_no_other_workspace_available(
            self) -> None:
        """ Test the output of the timer start function with the `-w/--workspace` argument when there is no extra workspace available. 

        This command output should print out a warning to the user about there only being one workspace on the account.
        """
        out1 = self._run_command('tgl start "description" -w')
        self.assertIn("Only one workspace available in the config file.", out1)
        self.assertIn(
            "If you recently added a workspace on your account, please use 'tgl reconfig' to reconfigure your data.",
            out1)
        self.assertIn("Using default workspace.", out1)
        self.assertIn("Timer started.", out1)

        tgl_stop()

        out2 = self._run_command('tgl start "description" --workspace')
        self.assertIn("Only one workspace available in the config file.", out2)
        self.assertIn(
            "If you recently added a workspace on your account, please use 'tgl reconfig' to reconfigure your data.",
            out2)
        self.assertIn("Using default workspace.", out2)
        self.assertIn("Timer started.", out2)
Example #5
0
 def tearDown(self) -> None:
     tgl_stop()
     delete_user_data()
     return super().tearDown()