예제 #1
0
    def test_setting_all_languages(self):
        layer = LocalizedRobotLayer('all')
        self.assertIn('en', layer._languages)
        self.assertIn('de', layer._languages)
        self.assertIn('ar', layer._languages)

        layer = LocalizedRobotLayer('*')
        self.assertIn('en', layer._languages)
        self.assertIn('de', layer._languages)
        self.assertIn('ar', layer._languages)
예제 #2
0
    def test_german_works_with_patching_layer(self):
        ns = self.mocker.patch(self.namespace)
        self.expect(ns._get_handler("deutscher text")).count(1)

        self.replay()

        layer = LocalizedRobotLayer(languages=["en", "de"])
        layer.setUp()

        try:
            ns._get_bdd_style_handler("Gegeben sei deutscher text")
        finally:
            layer.tearDown()
예제 #3
0
 def test_multiple_languages(self):
     layer = LocalizedRobotLayer(languages=["en", "de"])
     self.assertEqual(
         layer._get_bdd_prefixes(),
         [
             "given ",
             "when ",
             "then ",
             "and ",
             "but ",
             "angenommen ",
             "gegeben sei ",
             "wenn ",
             "dann ",
             "und ",
             "aber ",
         ],
     )
예제 #4
0
    def test_german_works_with_patching_layer(self):
        ns = self.mocker.patch(self.namespace)
        self.expect(ns._get_handler('deutscher text')).count(1)

        self.replay()

        layer = LocalizedRobotLayer(languages=['en', 'de'])
        layer.setUp()

        try:
            ns._get_bdd_style_handler('Gegeben sei deutscher text')
        finally:
            layer.tearDown()
예제 #5
0
 def test_get_translations(self):
     layer = LocalizedRobotLayer()
     self.assertIn("en", layer._get_translations())
예제 #6
0
 def test_german(self):
     layer = LocalizedRobotLayer(languages=["de"])
     self.assertEqual(layer._get_bdd_prefixes(), ["angenommen ", "gegeben sei ", "wenn ", "dann ", "und ", "aber "])
예제 #7
0
 def test_english(self):
     layer = LocalizedRobotLayer(languages=["en"])
     self.assertEqual(layer._get_bdd_prefixes(), ["given ", "when ", "then ", "and ", "but "])
예제 #8
0
 def test_get_translations(self):
     layer = LocalizedRobotLayer()
     self.assertIn('en', layer._get_translations())
예제 #9
0
 def test_setting_multiple_languages(self):
     self.assertEqual(
         LocalizedRobotLayer(['en', 'de'])._languages, ['en', 'de'])
예제 #10
0
 def test_default_language_is_english(self):
     self.assertEqual(LocalizedRobotLayer()._languages, ['en'])
예제 #11
0
 def test_multiple_languages(self):
     layer = LocalizedRobotLayer(languages=['en', 'de'])
     self.assertEqual(layer._get_bdd_prefixes(), [
         'given ', 'when ', 'then ', 'and ', 'but ', 'angenommen ',
         'gegeben sei ', 'wenn ', 'dann ', 'und ', 'aber '
     ])
예제 #12
0
 def test_german(self):
     layer = LocalizedRobotLayer(languages=['de'])
     self.assertEqual(
         layer._get_bdd_prefixes(),
         ['angenommen ', 'gegeben sei ', 'wenn ', 'dann ', 'und ', 'aber '])
예제 #13
0
 def test_english(self):
     layer = LocalizedRobotLayer(languages=['en'])
     self.assertEqual(layer._get_bdd_prefixes(),
                      ['given ', 'when ', 'then ', 'and ', 'but '])