Beispiel #1
0
 def test_get_project(self):
     command = TopLevelCommand()
     command.base_dir = 'tests/fixtures/longer-filename-figfile'
     project = command.get_project(command.get_config_path())
     self.assertEqual(project.name, 'longerfilenamefigfile')
     self.assertTrue(project.client)
     self.assertTrue(project.services)
Beispiel #2
0
 def test_project_name_from_environment(self):
     command = TopLevelCommand()
     name = 'namefromenv'
     with mock.patch.dict(os.environ):
         os.environ['FIG_PROJECT_NAME'] = name
         project_name = command.get_project_name(None)
     self.assertEquals(project_name, name)
Beispiel #3
0
    def test_default_project_name(self):
        cwd = os.getcwd()

        try:
            os.chdir('tests/fixtures/simple-figfile')
            command = TopLevelCommand()
            project_name = command.get_project_name(command.get_config_path())
            self.assertEquals('simplefigfile', project_name)
        finally:
            os.chdir(cwd)
Beispiel #4
0
 def setUp(self):
     super(CLITestCase, self).setUp()
     self.command = TopLevelCommand()
     self.command.base_dir = 'tests/fixtures/simple-figfile'
Beispiel #5
0
 def test_help(self):
     command = TopLevelCommand()
     with self.assertRaises(SystemExit):
         command.dispatch(['-h'], None)
Beispiel #6
0
 def test_yaml_filename_check(self):
     command = TopLevelCommand()
     command.base_dir = 'tests/fixtures/longer-filename-figfile'
     with mock.patch('fig.cli.command.log', autospec=True) as mock_log:
         self.assertTrue(command.get_config_path())
     self.assertEqual(mock_log.warning.call_count, 2)
Beispiel #7
0
 def test_project_name_with_explicit_project_name(self):
     command = TopLevelCommand()
     name = 'explicit-project-name'
     project_name = command.get_project_name(None, project_name=name)
     self.assertEquals('explicitprojectname', project_name)
Beispiel #8
0
 def test_project_name_with_explicit_base_dir(self):
     command = TopLevelCommand()
     command.base_dir = 'tests/fixtures/simple-figfile'
     project_name = command.get_project_name(command.get_config_path())
     self.assertEquals('simplefigfile', project_name)
Beispiel #9
0
 def setUp(self):
     super(CLITestCase, self).setUp()
     self.old_sys_exit = sys.exit
     sys.exit = lambda code=0: None
     self.command = TopLevelCommand()
     self.command.base_dir = 'tests/fixtures/simple-figfile'
Beispiel #10
0
 def test_yaml_filename_check(self):
     command = TopLevelCommand()
     command.base_dir = 'tests/fixtures/longer-filename-figfile'
     self.assertTrue(command.project.get_service('definedinyamlnotyml'))