コード例 #1
0
ファイル: test_tasks.py プロジェクト: uetuluk/edx-platform
    def test_revoke_program_certificate(self, mock_get_api_base_url):
        """
        Ensure the correct API call gets made
        """
        mock_get_api_base_url.return_value = 'http://test-server/'
        test_username = '******'
        test_client = requests.Session()
        test_client.auth = SuppliedJwtAuth('test-token')

        httpretty.register_uri(
            httpretty.POST,
            'http://test-server/credentials/',
        )

        tasks.revoke_program_certificate(test_client, test_username, 123)

        expected_body = {
            'username': test_username,
            'status': 'revoked',
            'credential': {
                'program_uuid': 123,
                'type': tasks.PROGRAM_CERTIFICATE,
            }
        }
        last_request_body = httpretty.last_request().body.decode('utf-8')
        assert json.loads(last_request_body) == expected_body
コード例 #2
0
ファイル: test_tasks.py プロジェクト: sshyran/edx-platform
    def test_revoke_program_certificate(self):
        """
        Ensure the correct API call gets made
        """
        test_username = '******'
        test_client = EdxRestApiClient('http://test-server', jwt='test-token')

        httpretty.register_uri(
            httpretty.POST,
            'http://test-server/credentials/',
        )

        tasks.revoke_program_certificate(test_client, test_username, 123)

        expected_body = {
            'username': test_username,
            'status': 'revoked',
            'credential': {
                'program_uuid': 123,
                'type': tasks.PROGRAM_CERTIFICATE,
            }
        }
        last_request_body = httpretty.last_request().body.decode('utf-8')
        assert json.loads(last_request_body) == expected_body