Language: Python
Label: vulnerable
CWE: CWE-203 \u2014 Observable Discrepancy
The product behaves differently or sends different responses under different circumstances in a way that is observable to an unauthorized actor, which exposes security-relevant information about the state of the product, such as whether a particular operation was successful or not.

Code:
    def test_it_works(self):
        form = {"identity": "alice@example.org", "tz": "Europe/Riga"}

        r = self.client.post("/accounts/signup/", form)
        self.assertContains(r, "Account created")
        self.assertIn("auto-login", r.cookies)

        # An user should have been created
        user = User.objects.get()

        # A profile should have been created
        profile = Profile.objects.get()
        self.assertEqual(profile.check_limit, 10000)
        self.assertEqual(profile.sms_limit, 10000)
        self.assertEqual(profile.call_limit, 10000)
        self.assertEqual(profile.tz, "Europe/Riga")

        # And email sent
        self.assertEqual(len(mail.outbox), 1)
        subject = "Log in to %s" % settings.SITE_NAME
        self.assertEqual(mail.outbox[0].subject, subject)

        # A project should have been created
        project = Project.objects.get()
        self.assertEqual(project.owner, user)
        self.assertEqual(project.badge_key, user.username)

        # And check should be associated with the new user
        check = Check.objects.get()
        self.assertEqual(check.name, "My First Check")
        self.assertEqual(check.slug, "my-first-check")
        self.assertEqual(check.project, project)

        # A channel should have been created
        channel = Channel.objects.get()
        self.assertEqual(channel.project, project)