Beispiel #1
0
 def test_overrides(self):
     lines = '''
     foo := bar
     fee := DB_$typo
     '''.splitlines()
     d = resolve([lines], {'typo': 'TEST'}, {'fee': 'OVERRIDE'})
     self.assertEqual(d['foo'], 'bar')
     self.assertEqual(d['fee'], 'OVERRIDE')
Beispiel #2
0
 def test_overrides(self):
     lines = '''
     foo := bar
     fee := DB_$typo
     '''.splitlines()
     d = resolve([lines], {'typo': 'TEST'}, {'fee': 'OVERRIDE'})
     self.assertEqual(d['foo'], 'bar')
     self.assertEqual(d['fee'], 'OVERRIDE')
Beispiel #3
0
 def test_defaults(self):
     lines = '''
     foo := bar
     fee := DB_$typo
     '''.splitlines()
     d = resolve([lines], {'typo': 'TEST'})
     self.assertEqual(d['foo'], 'bar')
     self.assertEqual(d['fee'], 'DB_TEST')
Beispiel #4
0
 def test_defaults(self):
     lines = '''
     foo := bar
     fee := DB_$typo
     '''.splitlines()
     d = resolve([lines], {'typo': 'TEST'})
     self.assertEqual(d['foo'], 'bar')
     self.assertEqual(d['fee'], 'DB_TEST')
Beispiel #5
0
 def test_default_separators(self):
     lines = '''
     foo := bar
     fee:= fum
     fab :=day
     null :=
     '''.splitlines()
     d = resolve([lines])
     self.assertEqual(d['foo'], 'bar')
     self.assertEqual(d['fee'], 'fum')
     self.assertEqual(d['fab'], 'day')
     self.assertEqual(d['null'], '')
     lines = '''
     foo = bar
     fee= fum
     fab =day
     null =
     '''.splitlines()
     d = resolve([lines])
     self.assertEqual(d['foo'], 'bar')
     self.assertEqual(d['fee'], 'fum')
     self.assertEqual(d['fab'], 'day')
     self.assertEqual(d['null'], '')
Beispiel #6
0
 def test_default_separators(self):
     lines = '''
     foo := bar
     fee:= fum
     fab :=day
     null :=
     '''.splitlines()
     d = resolve([lines])
     self.assertEqual(d['foo'], 'bar')
     self.assertEqual(d['fee'], 'fum')
     self.assertEqual(d['fab'], 'day')
     self.assertEqual(d['null'], '')
     lines = '''
     foo = bar
     fee= fum
     fab =day
     null =
     '''.splitlines()
     d = resolve([lines])
     self.assertEqual(d['foo'], 'bar')
     self.assertEqual(d['fee'], 'fum')
     self.assertEqual(d['fab'], 'day')
     self.assertEqual(d['null'], '')
Beispiel #7
0
 def test_interpolation(self):
     lines = '''
     foo := bar
     fat := cat
     fee := DB_${foo}
     fab := ${fee} TABLE_${foo}
     baf := TABLE_${foo} $fee
     fit := $fat ${fab}
     tif := $fab $fat
     '''.splitlines()
     d = resolve([lines])
     self.assertEqual(d['foo'], 'bar')
     self.assertEqual(d['fee'], 'DB_bar')
     self.assertEqual(d['fab'], 'DB_bar TABLE_bar')
     self.assertEqual(d['baf'], 'TABLE_bar DB_bar')
     self.assertEqual(d['fit'], 'cat DB_bar TABLE_bar')
     self.assertEqual(d['tif'], 'DB_bar TABLE_bar cat')
Beispiel #8
0
 def test_interpolation(self):
     lines = '''
     foo := bar
     fat := cat
     fee := DB_${foo}
     fab := ${fee} TABLE_${foo}
     baf := TABLE_${foo} $fee
     fit := $fat ${fab}
     tif := $fab $fat
     '''.splitlines()
     d = resolve([lines])
     self.assertEqual(d['foo'], 'bar')
     self.assertEqual(d['fee'], 'DB_bar')
     self.assertEqual(d['fab'], 'DB_bar TABLE_bar')
     self.assertEqual(d['baf'], 'TABLE_bar DB_bar')
     self.assertEqual(d['fit'], 'cat DB_bar TABLE_bar')
     self.assertEqual(d['tif'], 'DB_bar TABLE_bar cat')
Beispiel #9
0
 def test_multiple_input(self):
     common = '''
     foo := bar
     fee:= fum
     fab :=day
     null :=
     '''.splitlines()
     env_overrides = '''
     password := mysecret
     fab := night
     null := nolongernull
     '''.splitlines()
     d = resolve([common, env_overrides])
     self.assertEqual(d['foo'], 'bar')
     self.assertEqual(d['fee'], 'fum')
     self.assertEqual(d['fab'], 'night')
     self.assertEqual(d['null'], 'nolongernull')
     self.assertEqual(d['password'], 'mysecret')
Beispiel #10
0
 def test_multiple_input(self):
     common = '''
     foo := bar
     fee:= fum
     fab :=day
     null :=
     '''.splitlines()
     env_overrides = '''
     password := mysecret
     fab := night
     null := nolongernull
     '''.splitlines()
     d = resolve([common, env_overrides])
     self.assertEqual(d['foo'], 'bar')
     self.assertEqual(d['fee'], 'fum')
     self.assertEqual(d['fab'], 'night')
     self.assertEqual(d['null'], 'nolongernull')
     self.assertEqual(d['password'], 'mysecret')
Beispiel #11
0
 def test_empty_input(self):
     lines = '''
     '''.splitlines()
     d = resolve([lines])
     self.assertTrue(type(d) is dict)
     self.assertTrue(len(d) == 0)
Beispiel #12
0
 def test_empty_input(self):
     lines = '''
     '''.splitlines()
     d = resolve([lines])
     self.assertTrue(type(d) is dict)
     self.assertTrue(len(d) == 0)