def test_svn_with_more_options(self):
        # update svn repo to include username/password
        self.svn.username = "******"
        self.svn.password = "******"
        self.svn.save()

        co = CheckoutStep(
            builder=self.builder, name="svn checkout 2", mode="clobber", repository=self.svn, workdir="dir2"
        )
        co.save()
        self.assertTrue(co.id != None)
        self.assertEqual(unicode(co), "svn checkout 2")
        self.assertEqual(co.get_config_type(), _("source checkout"))

        args = co.get_config_args()
        self.assertEqual(args.get("mode", None), "clobber")
        self.assertEqual(args.get("svnurl", None), self.svn.url)
        self.assertEqual(args.get("workdir", None), "dir2")
        self.assertEqual(args.get("username", None), "myusername")
        self.assertEqual(args.get("password", None), "mypassword")

        # try instantiating buildbot config object
        self.assert_valid_buildbot_config(co.get_config_class(), args)

        # Check that the resulting config string is sensible
        self.assert_config_string_executable(co)
    def test_simple_creation_git(self):
        co = CheckoutStep(builder=self.builder, name="git checkout", repository=self.git)
        co.save()
        self.assertTrue(co.id != None)
        self.assertEqual(unicode(co), "git checkout")
        self.assertEqual(co.get_config_type(), _("source checkout"))

        args = co.get_config_args()
        self.assertEqual(args.get("mode", None), getattr(settings, "DEFAULT_CHECKOUT_MODE"))
        self.assertEqual(args.get("repourl", None), self.git.url)
        self.assertEqual(args.get("workdir", None), "build")

        # try instantiating buildbot config object
        self.assert_valid_buildbot_config(co.get_config_class(), args)

        # Check that the resulting config string is sensible
        self.assert_config_string_executable(co)
    def test_with_repo_parent(self):
        repo = self.project.repository_set.all()[0]  # 1st repo = svn
        co = CheckoutStep(builder=self.builder, name="generic checkout", repository=repo)
        co.save()

        self.assertTrue(co.id != None)
        self.assertEqual(unicode(co), "generic checkout")
        self.assertEqual(co.get_config_type(), _("source checkout"))

        args = co.get_config_args()
        self.assertEqual(args.get("mode", None), "update")
        self.assertEqual(args.get("svnurl", None), self.svn.url)

        # try instantiating buildbot config object
        self.assert_valid_buildbot_config(co.get_config_class(), args)

        # Check that the resulting config string is sensible
        self.assert_config_string_executable(co)
    def test_git_with_more_options(self):
        co = CheckoutStep(
            builder=self.builder, name="git checkout 2", mode="clobber", repository=self.git, workdir="dir2"
        )
        co.save()
        self.assertTrue(co.id != None)
        self.assertEqual(unicode(co), "git checkout 2")
        self.assertEqual(co.get_config_type(), _("source checkout"))

        args = co.get_config_args()
        self.assertEqual(args.get("mode", None), "clobber")
        self.assertEqual(args.get("repourl", None), self.git.url)
        self.assertEqual(args.get("workdir", None), "dir2")

        # try instantiating buildbot config object
        self.assert_valid_buildbot_config(co.get_config_class(), args)

        # Check that the resulting config string is sensible
        self.assert_config_string_executable(co)