def test_get_bower(self): args = parser.parse_args(['--create', 'ds-two']) args = pos_parser(args) # simulate argument from CLI args.__dict__['name'] = 'iron-element' bower = Bower(bower_json=args.__dict__) self.assertIsInstance(bower.bower, dict)
def test_setter_bower(self): args = parser.parse_args(['--create', 'ds-three']) args = pos_parser(args) # simulate argument from CLI args.__dict__['name'] = 'iron-element' bower = Bower(bower_json=args.__dict__) data = bower.to_json() bower.bower = data # json/string self.assertIsInstance(bower.bower, dict) self.assertEqual(bower.bower['name'], 'iron-element')
def test_json(self): args = parser.parse_args(['--create', 'ds-one']) args = pos_parser(args) # simulate argument from CLI args.__dict__['name'] = 'iron-element' bower = Bower(bower_json=args.__dict__) self.assertIsInstance(bower, Bower) data = bower.to_json() self.assertIsInstance(data, str) data = json.loads(data) self.assertIsInstance(data, dict)
def test_create_no_name(self): """Tests if directory was created. """ args = parser.parse_args(['--private', False]) args = pos_parser(args) el = PolymerElement(args, **args.__dict__) el.create() self.target_dir = os.path.abspath('.') demo_dir = self.target_dir + '/demo' test_dir = self.target_dir + '/test' self.assertTrue(os.path.exists(self.target_dir)) self.assertTrue(os.path.exists(demo_dir)) self.assertTrue(os.path.exists(test_dir))
def test_pos_parser(self): """ tests if json is built correctly """ args = parser.parse_args(['--create', 'ds-new']) args_pos = pos_parser(args) self.assertIsInstance(args_pos, argparse.Namespace)