Ejemplo n.º 1
0
 def test_can_generate_a_lxdock_file_by_overwriting_an_existing_file_with_the_force_option(
         self, mock_getcwd, mock_open):
     mock_getcwd.return_value = os.path.join(FIXTURE_ROOT, 'project01')
     fd_mock = unittest.mock.Mock()
     mock_open.return_value.__enter__.return_value = fd_mock
     LXDock(['init', '--force'])
     assert mock_open.call_count == 1
     assert mock_open.call_args[0] == ('lxdock.yml', )
     assert fd_mock.write.call_count == 1
     assert fd_mock.write.call_args[0][
         0] == INIT_LXDOCK_FILE_CONTENT.format(project_name=os.path.split(
             os.getcwd())[1],
                                               image='ubuntu/bionic')
Ejemplo n.º 2
0
 def test_can_generate_a_basic_lxdock_file(self, mock_open):
     fd_mock = unittest.mock.Mock()
     mock_open.return_value.__enter__.return_value = fd_mock
     LXDock([
         'init',
     ])
     assert mock_open.call_count == 1
     assert mock_open.call_args[0] == ('lxdock.yml', )
     assert fd_mock.write.call_count == 1
     assert fd_mock.write.call_args[0][
         0] == INIT_LXDOCK_FILE_CONTENT.format(project_name=os.path.split(
             os.getcwd())[1],
                                               image='ubuntu/bionic')
Ejemplo n.º 3
0
 def test_can_generate_a_lxdock_file_with_a_custom_project_name(
         self, mock_open):
     fd_mock = unittest.mock.Mock()
     mock_open.return_value.__enter__.return_value = fd_mock
     LXDock([
         'init',
         '--project',
         'customproject',
     ])
     assert mock_open.call_count == 1
     assert mock_open.call_args[0] == ('lxdock.yml', )
     assert fd_mock.write.call_count == 1
     assert fd_mock.write.call_args[0][
         0] == INIT_LXDOCK_FILE_CONTENT.format(project_name='customproject',
                                               image='ubuntu/bionic')
Ejemplo n.º 4
0
 def test_can_generate_a_lxdock_file_with_a_custom_image(self, mock_open):
     fd_mock = unittest.mock.Mock()
     mock_open.return_value.__enter__.return_value = fd_mock
     LXDock([
         'init',
         '--image',
         'debian/buster',
     ])
     assert mock_open.call_count == 1
     assert mock_open.call_args[0] == ('lxdock.yml', )
     assert fd_mock.write.call_count == 1
     assert fd_mock.write.call_args[0][
         0] == INIT_LXDOCK_FILE_CONTENT.format(project_name=os.path.split(
             os.getcwd())[1],
                                               image='debian/buster')