def test_update_linguas(self): translation = self.get_translation() self.assertTrue( UpdateLinguasAddon.can_install(translation.component, None) ) addon = UpdateLinguasAddon.create(translation.component) addon.post_add(translation) self.assertTrue( os.path.exists(translation.addon_commit_files[0]) )
def test_add(self): UpdateLinguasAddon.create(self.component) UpdateConfigureAddon.create(self.component) TestAddon.create(self.component) rev = self.component.repository.last_revision self.component.add_new_language(Language.objects.get(code="sk"), None) self.assertNotEqual(rev, self.component.repository.last_revision) commit = self.component.repository.show( self.component.repository.last_revision) self.assertIn("po/LINGUAS", commit) self.assertIn("configure", commit)
def test_add(self): UpdateLinguasAddon.create(self.subproject) UpdateConfigureAddon.create(self.subproject) TestAddon.create(self.subproject) rev = self.subproject.repository.last_revision self.subproject.add_new_language(Language.objects.get(code='sk'), None) self.assertNotEqual(rev, self.subproject.repository.last_revision) commit = self.subproject.repository.show( self.subproject.repository.last_revision) self.assertIn('po/LINGUAS', commit) self.assertIn('configure', commit)
def test_add(self): UpdateLinguasAddon.create(self.component) UpdateConfigureAddon.create(self.component) TestAddon.create(self.component) rev = self.component.repository.last_revision self.component.add_new_language( Language.objects.get(code='sk'), None ) self.assertNotEqual(rev, self.component.repository.last_revision) commit = self.component.repository.show( self.component.repository.last_revision ) self.assertIn('po/LINGUAS', commit) self.assertIn('configure', commit)
def assert_linguas(self, source, expected_add, expected_remove): # Test no-op self.assertEqual( UpdateLinguasAddon.update_linguas(source, {"de", "it"}), (False, source)) # Test adding cs self.assertEqual( UpdateLinguasAddon.update_linguas(source, {"cs", "de", "it"}), (True, expected_add), ) # Test adding cs and removing de self.assertEqual( UpdateLinguasAddon.update_linguas(source, {"cs", "it"}), (True, expected_remove), )
def test_update_linguas(self): translation = self.get_translation() self.assertTrue(UpdateLinguasAddon.can_install(translation.component, None)) addon = UpdateLinguasAddon.create(translation.component) commit = self.component.repository.show(self.component.repository.last_revision) self.assertIn("LINGUAS", commit) self.assertIn("\n+cs\n", commit) addon.post_add(translation) self.assertEqual(translation.addon_commit_files, []) other = self._create_component( "po", "po-duplicates/*.dpo", name="Other", project=self.project ) self.assertTrue(UpdateLinguasAddon.can_install(other, None)) addon = UpdateLinguasAddon.create(other) commit = other.repository.show(other.repository.last_revision) self.assertIn("LINGUAS", commit) self.assertIn("\n+cs de it", commit)