示例#1
0
 def test_changes(self):
     """blueprints changes"""
     with captured_output() as (out, _):
         rc = blueprints_changes("/run/weldr/api.socket", 0, ["example-http-server"], show_json=False)
     output = out.getvalue().strip()
     self.assertTrue(rc == 0)
     self.assertTrue("example-http-server" in output)
     self.assertTrue("Recipe example-http-server, version 0.0.1 saved." in output)
示例#2
0
    def test_undo(self):
        """blueprints undo"""
        # Get the oldest commit, it should be 2nd to last line
        with captured_output() as (out, _):
            rc = blueprints_changes("/run/weldr/api.socket", 0, ["example-http-server"], show_json=False)
        output = out.getvalue().strip().splitlines()
        first_commit = output[-2].split()[1]

        with captured_output() as (out, _):
            rc = blueprints_undo("/run/weldr/api.socket", 0, ["example-http-server", first_commit, "HEAD"], show_json=False)
        output = out.getvalue().strip()
        self.assertTrue(rc == 0)