Exemple #1
0
    def test_update_regular_file(self):
        fileobj, filename = tempfile.mkstemp(suffix=".py", text=True)

        # setup
        with open(filename, "w") as fileobj:
            fileobj.write("This is a test of the emergency {broadcast} system.")

        create.update_file(filename, {"broadcast": "kitten"})

        with open(filename, "r") as fileobj:
            result = fileobj.read()
        self.assertEqual("This is a test of the emergency kitten system.", result)
Exemple #2
0
    def test_update_regular_file(self):
        fileobj, filename = tempfile.mkstemp(suffix='.py', text=True)

        # setup
        with open(filename, 'w') as fileobj:
            fileobj.write('This is a test of the emergency {broadcast} system.')

        create.update_file(filename, {'broadcast': 'kitten'})

        with open(filename, 'r') as fileobj:
            result = fileobj.read()
        self.assertEqual('This is a test of the emergency kitten system.', result)
Exemple #3
0
    def test_update_xml_file(self):
        fileobj, filename = tempfile.mkstemp(suffix=".xml", text=True)
        print filename

        # setup
        with open(filename, "w") as fileobj:
            fileobj.write("<tag provider={provider}/>")

        create.update_file(filename, {"provider": "name aka \"another name\" <*****@*****.**> 'foo'"})

        with open(filename, "r") as fileobj:
            result = fileobj.read()
        expected = "<tag provider=\"name aka &quot;another name&quot; &lt;[email protected]&gt; 'foo'\"/>"
        self.assertEqual(expected, result)
    def test_update_regular_file(self):
        fileobj, filename = tempfile.mkstemp(suffix='.py', text=True)

        # setup
        with open(filename, 'w') as fileobj:
            fileobj.write(
                'This is a test of the emergency {broadcast} system.')

        create.update_file(filename, {'broadcast': 'kitten'})

        with open(filename, 'r') as fileobj:
            result = fileobj.read()
        self.assertEqual('This is a test of the emergency kitten system.',
                         result)
Exemple #5
0
    def test_update_xml_file(self):
        fileobj, filename = tempfile.mkstemp(suffix='addon.xml', text=True)
        print filename

        # setup
        with open(filename, 'w') as fileobj:
            fileobj.write('<tag provider={provider}/>')

        create.update_file(filename, {'provider': 'name aka "another name" <*****@*****.**> \'foo\''})

        with open(filename, 'r') as fileobj:
            result = fileobj.read()
        expected = '<tag provider="name aka &quot;another name&quot; &lt;[email protected]&gt; \'foo\'"/>'
        self.assertEqual(expected, result)
    def test_update_xml_file(self):
        fileobj, filename = tempfile.mkstemp(suffix='addon.xml', text=True)
        print filename

        # setup
        with open(filename, 'w') as fileobj:
            fileobj.write('<tag provider={provider}/>')

        create.update_file(
            filename,
            {'provider': 'name aka "another name" <*****@*****.**> \'foo\''})

        with open(filename, 'r') as fileobj:
            result = fileobj.read()
        expected = '<tag provider="name aka &quot;another name&quot; &lt;[email protected]&gt; \'foo\'"/>'
        self.assertEqual(expected, result)