def test_already_awarded(self):
        """Can award badges from API"""
        description = "Is a hoopy frood."
        invite_email = 'someguy@example.com'
        award_user = self._get_user(username="awardee1",
                                    email="awardee1@example.com")

        award = self.badge.award_to(email=award_user.email)
        deferred_award = self.badge.award_to(email=invite_email)

        # Construct the request data...
        data = dict(
            description = description,
            emails = [
                invite_email,
                award_user.email,
            ],
        )

        # POST to the awards URL
        resp = self.client.post(self.awards_url, json.dumps(data),
                                content_type='application/json',
                                HTTP_AUTHORIZATION=self.basic_auth)
        
        eq_('application/json', resp['Content-Type'])
        data = json.loads(resp.content)

        print "DATA %s" % data

        ok_('errors' in data)
        ok_(award_user.email in data['errors'])
        eq_('ALREADYAWARDED', data['errors'][award_user.email])
        ok_(invite_email in data['errors'])
        eq_('ALREADYAWARDED', data['errors'][invite_email])
dataset/ETHPy150Open lmorchard/badg.us/badgus/badger_api/tests/test_views.py/BadgerApiViewsTests.test_already_awarded/original