def test_upload(self): upload.main() self.assertEqual( 'Snap snap-test_1.0_amd64.snap not found. ' 'Running snap step to create it.\n' 'Pulling part1 \n' 'Building part1 \n' 'Staging part1 \n' 'Stripping part1 \n' 'Snapping snap-test_1.0_amd64.snap\n' 'Snapped snap-test_1.0_amd64.snap\n', self.fake_logger.output) self.assertTrue(os.path.exists(common.get_stagedir()), 'Expected a stage directory') self.assertTrue(self.state_file, 'Expected a state file for the part1 part') with open(self.state_file) as sf: state = sf.readlines() self.assertEqual( len(state), 1, 'Expected only one line in the state ' 'file for the part1 part') self.assertEqual(state[0], 'strip', "Expected the state file for " "part1 to be 'strip'") self.mock_upload.assert_called_once_with( 'snap-test_1.0_amd64.snap', 'snap-test', config=self.mock_load_config.return_value)
def test_upload(self): upload.main() self.assertEqual( 'Snap snap-test_1.0_amd64.snap not found. ' 'Running snap step to create it.\n' 'Pulling part1 \n' 'Building part1 \n' 'Staging part1 \n' 'Stripping part1 \n' 'Snapping snap-test_1.0_amd64.snap\n' 'Snapped snap-test_1.0_amd64.snap\n', self.fake_logger.output) self.assertTrue(os.path.exists(common.get_stagedir()), 'Expected a stage directory') self.assertTrue(self.state_file, 'Expected a state file for the part1 part') with open(self.state_file) as sf: state = sf.readlines() self.assertEqual(len(state), 1, 'Expected only one line in the state ' 'file for the part1 part') self.assertEqual(state[0], 'strip', "Expected the state file for " "part1 to be 'strip'") self.mock_upload.assert_called_once_with( 'snap-test_1.0_amd64.snap', 'snap-test', config=self.mock_load_config.return_value)
def test_just_upload_if_snap_file_exists(self): self.mock_os.path.exists.return_value = True upload.main() # stages are not build if snap file already exists self.assertFalse(os.path.exists(common.get_stagedir()), 'Expected a stage directory') self.assertFalse(os.path.exists(self.statedir)) self.mock_upload.assert_called_once_with( 'snap-test_1.0_amd64.snap', 'snap-test', config=self.mock_load_config.return_value)
def test_just_upload_if_snap_file_exists(self): self.mock_os.path.exists.return_value = True upload.main() # stages are not build if snap file already exists self.assertFalse(os.path.exists(common.get_stagedir()), 'Expected a stage directory') self.assertFalse(os.path.exists(self.state_file)) self.mock_upload.assert_called_once_with( 'snap-test_1.0_amd64.snap', 'snap-test', config=self.mock_load_config.return_value)
def test_just_upload_if_snap_file_exists(self): self.mock_os.path.exists.return_value = True upload.main() self.assertEqual( 'Uploading snap-test_1.0_amd64.snap\n' 'snap-test_1.0_amd64.snap upload complete\n', self.fake_logger.output) # stages are not build if snap file already exists self.assertFalse(os.path.exists(common.get_stagedir()), 'Expected a stage directory') self.assertFalse(os.path.exists(self.state_file)) self.mock_upload.assert_called_once_with( 'snap-test_1.0_amd64.snap', config=self.mock_load_config.return_value)
def test_upload(self): upload.main() self.assertEqual( 'Snap snap-test_1.0_amd64.snap not found. ' 'Running snap step to create it.\n' 'Pulling part1 \n' 'Building part1 \n' 'Staging part1 \n' 'Stripping part1 \n' 'Snapping snap-test_1.0_amd64.snap\n' 'Snapped snap-test_1.0_amd64.snap\n', self.fake_logger.output) self.assertTrue(os.path.exists(common.get_stagedir()), 'Expected a stage directory') self.verify_state('part1', self.statedir, 'strip') self.mock_upload.assert_called_once_with( 'snap-test_1.0_amd64.snap', 'snap-test', config=self.mock_load_config.return_value)