Esempio n. 1
0
 def test_init_active_state(self):
     # Blocks should always start out as off or closed (visible)
     b = Block.from_itemname('Activation Module')
     b2 = Block.from_itemname('Plex Door')
     assert b.active == False
     assert b2.active == False
     b.toggle()
     assert b.active == True
     b.on()
     assert b.active == True
     b.off()
     assert b.active == False
Esempio n. 2
0
 def test_init(self):
     block1 = Block.from_itemname('Grey Standard Armor')
     block2 = Block(5)
     assert block1.name == block2.name
     assert block1.id == block2.id
     block3 = Block(5, posy=3)
     assert block3.posy == 3
Esempio n. 3
0
 def test_save_new_data(self):
     saved_name = tpl_dir + 'generate.smtpl'
     t1 = Template()
     b1 = Block.from_itemname('Activation Module')
     b2 = Block(409, posy=1)
     t1.connect_blocks(b1, b2)
     t1.add(b1)
     t1.add(b2)
     t1.save(saved_name)
     t2 = Template.fromSMTPL(saved_name)
     os.remove(saved_name)
     assert t1.num_blocks() == t2.num_blocks()
     assert t1.num_connections() == t2.num_connections()
Esempio n. 4
0
 def test_change_color(self):
     block = Block.from_itemname('Grey Standard Armor')
     assert block.color == 'grey'
     block.change_color('blue')
     assert block.color != 'grey'
     assert block.color == 'blue'