def test_whatis_layer(self):
        '''Validate classic charm dir.'''
        asset = 'layer'
        asset_path = os.path.join('unit_tests', 'charm_what_test_files', asset)

        result = utils.whatis(asset_path)
        self.assertEqual(EXPECTED[asset], result)
    def test_whatis_interface(self):
        '''Validate interface dir.'''
        asset = 'interface'
        asset_path = os.path.join('unit_tests', 'charm_what_test_files', asset)

        result = utils.whatis(asset_path)
        self.assertEqual(EXPECTED[asset], result)
    def test_whatis_source_charm(self):
        '''Validate source charm dir.'''
        asset = 'source-charm'
        asset_path = os.path.join('unit_tests', 'charm_what_test_files', asset)

        result = utils.whatis(asset_path)
        self.assertEqual(EXPECTED[asset], result)
    def test_whatis_unknown_foobar(self):
        '''An unknown folder is not identified.'''
        asset = 'foobar'
        asset_path = os.path.join('unit_tests', 'charm_what_test_files', asset)

        result = utils.whatis(asset_path)
        self.assertEqual(EXPECTED[asset], result)
Beispiel #5
0
def main():
    opts, args = option_handler()
    asset_type = cw_utils.whatis(args[0])
    if asset_type:
        print(asset_type)
    else:
        print('{} is not a charm, interface or layer'.format(args[0]))
        sys.exit(1)
    def test_negative_whatis_layer(self):
        '''A layer is not a built charm.'''
        asset = 'layer'
        asset_path = os.path.join('unit_tests', 'charm_what_test_files',
                                  'built-charm')

        result = utils.whatis(asset_path)
        self.assertNotEqual(EXPECTED[asset], result)
    def test_negative_whatis_source_charm(self):
        '''A source charm is not a layer.'''
        asset = 'source-charm'
        asset_path = os.path.join('unit_tests', 'charm_what_test_files',
                                  'layer')

        result = utils.whatis(asset_path)
        self.assertNotEqual(EXPECTED[asset], result)
    def test_negative_whatis_interface(self):
        '''An interface is not a built charm.'''
        asset = 'interface'
        asset_path = os.path.join('unit_tests',
                                  'charm_what_test_files',
                                  'built-charm')

        result = utils.whatis(asset_path)
        self.assertNotEqual(EXPECTED[asset], result)
    def test_whatis_interface(self):
        '''Validate interface dir.'''
        asset = 'interface'
        asset_path = os.path.join('unit_tests',
                                  'charm_what_test_files',
                                  asset)

        result = utils.whatis(asset_path)
        self.assertEqual(EXPECTED[asset], result)
    def test_negative_whatis_classic_charm(self):
        '''A classic charm is not a built charm.'''
        asset = 'classic-charm'
        asset_path = os.path.join('unit_tests',
                                  'charm_what_test_files',
                                  'built-charm')

        result = utils.whatis(asset_path)
        self.assertNotEqual(EXPECTED[asset], result)
    def test_whatis_classic_charm(self):
        '''Validate classic charm dir.'''
        asset = 'classic-charm'
        asset_path = os.path.join('unit_tests',
                                  'charm_what_test_files',
                                  asset)

        result = utils.whatis(asset_path)
        self.assertEqual(EXPECTED[asset], result)
    def test_negative_whatis_source_charm(self):
        '''A source charm is not a layer.'''
        asset = 'source-charm'
        asset_path = os.path.join('unit_tests',
                                  'charm_what_test_files',
                                  'layer')

        result = utils.whatis(asset_path)
        self.assertNotEqual(EXPECTED[asset], result)
    def test_whatis_unknown_foobar(self):
        '''An unknown folder is not identified.'''
        asset = 'foobar'
        asset_path = os.path.join('unit_tests',
                                  'charm_what_test_files',
                                  asset)

        result = utils.whatis(asset_path)
        self.assertEqual(EXPECTED[asset], result)