Пример #1
0
 def test_no_project(self):
     with mock.patch('os.listdir') as listdir:
         assert not listdir.called
         with self.assertRaises(ValueError):
             cmds.get_project('wat')
Пример #2
0
 def test_project(self):
     with mock.patch('os.listdir') as listdir:
         with mock.patch('os.path.basename') as basename:
             basename.return_value = 'solitude'
             listdir.return_value = ['Dockerfile']
             assert cmds.get_project(None) == 'solitude'
Пример #3
0
 def test_no_dockerfile(self):
     with mock.patch('os.listdir') as listdir:
         listdir.return_value = []
         with self.assertRaises(ValueError):
             cmds.get_project(None)